M
Mohammed AlQuraishi
Hi,
I'm having trouble with synchronizing the order of server-side events, and I
was hoping someone here can shed some light on what's happening. In a
simplified version, I click on a button which changes the contents of a
textbox, something like:
private void btn_Click(object sender, System.EventArgs e)
{
TextBox1.Text = "I've changed";
}
Clicking the button changes TextBox1 as expected. Now, in the Page_Load
event, I'm trying to copy the contents of this textbox into another, like
this:
private void Page_Load(object sender, System.EventArgs e)
{
TextBox2.Text = TextBox1.Text;
}
Clicking the button once does not change TextBox2, suggesting that TextBox1
was changed AFTER Page_Load was invoked. I know that Page_Load is being
invoked because if I were to click the button again, TextBox2 does in fact
change. Why is this happening? Shouldn't the button post all the changes, at
which point Page_Load should pick them up? I.e. why is Page_Load being
executed after the contents of btn_Click(...) are excuted? And how can this
be changed?
Thanks for any information.
Mohammed
I'm having trouble with synchronizing the order of server-side events, and I
was hoping someone here can shed some light on what's happening. In a
simplified version, I click on a button which changes the contents of a
textbox, something like:
private void btn_Click(object sender, System.EventArgs e)
{
TextBox1.Text = "I've changed";
}
Clicking the button changes TextBox1 as expected. Now, in the Page_Load
event, I'm trying to copy the contents of this textbox into another, like
this:
private void Page_Load(object sender, System.EventArgs e)
{
TextBox2.Text = TextBox1.Text;
}
Clicking the button once does not change TextBox2, suggesting that TextBox1
was changed AFTER Page_Load was invoked. I know that Page_Load is being
invoked because if I were to click the button again, TextBox2 does in fact
change. Why is this happening? Shouldn't the button post all the changes, at
which point Page_Load should pick them up? I.e. why is Page_Load being
executed after the contents of btn_Click(...) are excuted? And how can this
be changed?
Thanks for any information.
Mohammed