Hi,
In a webform I have two textBoxes. In a formload event I will retrieve some data from db and will assign it to textboxes as below
textBox1.Text=dr.getValue(0).ToString(); (Sachi)
textBox2.Text=dr.getValue(1).ToString(); (Vasista)
Now in a button click event I will make some correction in the same textbox and I will asign those values to two string variables as below
string Fname=textBox1.Text.ToString(); (Sachin)
string Lname=textBox2.Text .ToString(); (Vasishta)
but when I checked the values of these 2 string variables using breakpoint the values were not changed, it was showing the old values which were retrieved from the db.
Thanks
Value not changing
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Kirtan PatelRank #292 · 8.6K reputationPosted Nov 13, 2009, 10:29 PM EST
you should Write Code Like Below
In FormLoad Event here !IsPostback us Necessary then it will work correctly
check "Do you like this answer check box" if it helps you :)
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
TextBox1.Text = dr.getValue(0).ToString();TextBox2.Text = dr.getValue(1).ToString();
}
}
sachi vasishta180 reputationPosted Nov 13, 2009, 11:30 PM EST