have a problem with text box

  • Thread starter Thread starter Lian
  • Start date Start date
L

Lian

Hello everybody
I have a problem with textbox. I'm initializing a textbox in page load
but every time I change the textbox and Text Changed is fired the text
turned beck to the original value and show the old value instead the
new one
How can I solve it?
 
Lian said:
Hello everybody
I have a problem with textbox. I'm initializing a textbox in page load
but every time I change the textbox and Text Changed is fired the text
turned beck to the original value and show the old value instead the
new one
How can I solve it?

Page_Load is called every time the page is requested from the server:
on initial access plus on postbacks!
You need to check "IsPostBack" to skip assigning on postback.

Hans Kesting
 
Assign the value to the text box only if its not a postback.

if (!IsPostBack)
{
txt.Text = <value>;
}

Hello everybody
I have a problem with textbox. I'm initializing a textbox in page load
but every time I change the textbox and Text Changed is fired the text
turned beck to the original value and show the old value instead the
new one
How can I solve it?
 
private void tbmachinenum_TextChanged(object sender, System.EventArgs e)
{
string tmp=this.tbmachinenum .Text;
this.lable1 .Text=tmp;
}
i tried with the IsPostBack but it still doesnt work. i added a label to
see what is going on and the out put is still the old value
please help me
 
Back
Top