I am writing an application in C #. I would like to replace the value for the TEXT property after the user clicks (focuses) on the text box. I want the TEXT value to be empty, instead of the words "ENTER NAME HERE" when they click to edit the text field.
Frontal:
<asp:TextBox Text="ENTER NAME HERE" OnClick="MyTextboxID_OnClick" ID="MyTextboxID" runat="server"></asp:TextBox>
Code for:
protected void MyTextboxID_OnClick(object sender, EventArgs e)
{
MyTextboxID.Text = "";
}
I tried to find the answer to this question, but the answers did not quite match what I wanted to do.
I was hoping C # had something similar to Javascript events "OnClick" or "OnFocus". I added the OnClick event to the text box for illustration. This OnClick event is not working.
Thank you in advance for your help!