With custom attributes (expando attributes, typical to web controls) which
are passed as-is to the client-browser (and can be used to append js to the
<asp:TextBox ID="TextBox1" runat="server"onfocus="this.select()" />
which passes the onfocus="this.select()" to browser to the INPUT element
(which is rendered), and again causes client js functionality to select the
text in textbox when it receives the focus.
ASP.NET MVP, AspInsider