private void update_Click(object sender, System.EventArgs e)
{
Label1.Text = TextBox1.Text;
}
As the program currently runs, clicking the button sends TextBox's
*first* value to Label1, not what was typed over it. That is, if
TextBox initially reads 'porkchop', change it to 'sandwiches' and
click the button, the label will read 'porkchop.'
My only idea of a solution is toggling AutoPostBack, but that didn't
help any. What else can I try?
Thanks.
Take a look at your Page_Load event. This always fires *before* the
Click event. If you are reloading the textbox from the database inside
Page_Load, it will overwrite whatever the user typed before you can pick it
up in the update_Click event. If this is what is happening, you can use an
"if (!Page.IsPostBack)" inside Page_Load to avoid executing that part of the
code during the postback.
That did it. Thanks so much!