Hi
I have a problem with 3 textBoxes. I need to set an inital value (texts) for each textBox
and when I need to change / rewrite a value in one of the textBoxes then the applicaiton will allow me to do so.
I tried to set the text for each textBox from the TextBox properties >> Text. but this doesn't display the
value in the textBox. and if I set the following:
private void TextBox1_TextChanged(object sender, EventArgs e)
{
TextBox1.Text = "InitialText1";
}
private void TextBox2_TextChanged(object sender, EventArgs e)
{
TextBox1.Text = "InitialText2";
}
private void TextBox3_TextChanged(object sender, EventArgs e)
{
TextBox1.Text = "InitialText3";
}
This will show the value in the textBox but will not allow me to change it at the run time.
What shall I do?
JyothiPosted Apr 15, 2014, 6:11 AM
Something like this
<ajaxToolkit:TextBoxWatermarkExtender ID="twFname" runat="server" TargetControlID="txtFirstname"
WatermarkText="Enter Your First Name" />
VulpesPosted Apr 15, 2014, 5:33 AM
When you do this, the initial values should show up immediately in the designer.
So, if I were you, I'd try and get to the bottom of this before you do anything else as whatever's causing the problem might come back and bite you later.
It might be an idea to delete these TextBoxes from the designer, add them back again and see if you can set their Text properties then.
I'd also remove the TextChanged handlers via the Properties Box as you don't need these unless you need to be notified when the Text property is subsequently changed.
Princy GuptaPosted Apr 15, 2014, 4:25 AM
Munesh SharmaPosted Apr 15, 2014, 3:13 AM
like that
textBox3.KeyPress += new KeyPressEventHandler(textBox3_KeyPress);