Thursday 23 February 2012

Select all text in textbox on click.

You can do it in the client side it self.
Just try this...
<asp:TextBox ID="txt1" runat="server" Text="Abc" onfocus="javascript:this.select();" ></asp:TextBox>
otherwise if you want to do it in the code behind 
write
txt1.Attributes.Add("onfocus","javascript:this.select();");
this in your page load event.

No comments:

Post a Comment