I have done that , but it is no effect
My code is:
protected void Page_Load(object sender, EventArgs e)
{
TextBox3.Attributes["onfocus"] = "this.selected()";
}
protected void Button1_Click(object sender, EventArgs e)
{
TextBox3.Focus();
}
But after I click Button1, the text in TextBox3 is not selected.
Eliyahu Goldin said:
TextBox renders as <input type=text ...>. This element has a method
select(). Setup a client-side onfocus event like this (c# syntax):
myTextBox.Attributes["onfocus"]="this.selected()";
Eliyahu
I want the text in a TextBox selected when the TextBox get focus.
How can I do that?