Thanks for your reply. Is there an event that occurs after all other
handlers? The problem is that I have a piece of code that needs to be
executed every time the page is loaded. This code also checks on some
variables, which the button click changes. I want those changes to be
affected before the Page_Load code executes. Where else ought I put it?
Thanks.
Mohammed
"Marina" <> wrote in message
news:...
> Page_Load happens before any event handlers for the server side UI
> objects.
>
> "Mohammed AlQuraishi" <> wrote in message
> news:%...
>> 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
>>
>>
>
>
|