Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Server-Side Events in ASP.NET 1.1

Reply
Thread Tools

Server-Side Events in ASP.NET 1.1

 
 
Mohammed AlQuraishi
Guest
Posts: n/a
 
      01-07-2005
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


 
Reply With Quote
 
 
 
 
Marina
Guest
Posts: n/a
 
      01-07-2005
Page_Load happens before any event handlers for the server side UI objects.

"Mohammed AlQuraishi" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
Mohammed AlQuraishi
Guest
Posts: n/a
 
      01-07-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Page_Load happens before any event handlers for the server side UI
> objects.
>
> "Mohammed AlQuraishi" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> 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
>>
>>

>
>



 
Reply With Quote
 
Marina
Guest
Posts: n/a
 
      01-07-2005
There are PreRender and Unload events that occur after all the server side
UI object events.

"Mohammed AlQuraishi" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Page_Load happens before any event handlers for the server side UI
> > objects.
> >
> > "Mohammed AlQuraishi" <(E-Mail Removed)> wrote in message
> > news:%(E-Mail Removed)...
> >> 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
> >>
> >>

> >
> >

>
>



 
Reply With Quote
 
Mohammed AlQuraishi
Guest
Posts: n/a
 
      01-07-2005
Thank you. PreRender should probably work; I'll give it a try.

Mohammed

"Marina" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> There are PreRender and Unload events that occur after all the server side
> UI object events.
>
> "Mohammed AlQuraishi" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > Page_Load happens before any event handlers for the server side UI
>> > objects.
>> >
>> > "Mohammed AlQuraishi" <(E-Mail Removed)> wrote in message
>> > news:%(E-Mail Removed)...
>> >> 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
>> >>
>> >>
>> >
>> >

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
runtime events that generate other controls and events newbye ASP .Net 0 07-06-2006 06:27 PM
Events Events Events Please Help Chris ASP .Net Web Controls 0 08-30-2005 08:21 PM
order of events - dynamic checkbox events =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?= ASP .Net 0 08-17-2005 10:36 PM
Re: passing variables between web page events & httpmodules events Alvin Bruney ASP .Net 1 11-24-2003 04:14 PM
Passing Variables between Web Page Events and HttpModule Events shiv ASP .Net 0 11-21-2003 04:29 PM



Advertisments