473,486 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Server-Side Events in ASP.NET 1.1

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
Nov 19 '05 #1
4 1154
Page_Load happens before any event handlers for the server side UI objects.

"Mohammed AlQuraishi" <si******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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

Nov 19 '05 #2
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" <so*****@nospam.com> wrote in message
news:ux**************@TK2MSFTNGP12.phx.gbl...
Page_Load happens before any event handlers for the server side UI
objects.

"Mohammed AlQuraishi" <si******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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


Nov 19 '05 #3
There are PreRender and Unload events that occur after all the server side
UI object events.

"Mohammed AlQuraishi" <si******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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" <so*****@nospam.com> wrote in message
news:ux**************@TK2MSFTNGP12.phx.gbl...
Page_Load happens before any event handlers for the server side UI
objects.

"Mohammed AlQuraishi" <si******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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



Nov 19 '05 #4
Thank you. PreRender should probably work; I'll give it a try.

Mohammed

"Marina" <so*****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
There are PreRender and Unload events that occur after all the server side
UI object events.

"Mohammed AlQuraishi" <si******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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" <so*****@nospam.com> wrote in message
news:ux**************@TK2MSFTNGP12.phx.gbl...
> Page_Load happens before any event handlers for the server side UI
> objects.
>
> "Mohammed AlQuraishi" <si******@hotmail.com> wrote in message
> news:%2****************@TK2MSFTNGP11.phx.gbl...
>> 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
>>
>>
>
>



Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4549
by: Phil | last post by:
I am using a Pascal like language (Wealth-Lab) on W2K and call this server: class HelloWorld: _reg_clsid_ = "{4E797C6A-5969-402F-8101-9C95453CF8F6}" _reg_desc_ = "Python Test COM Server"...
6
4433
by: Nathan Sokalski | last post by:
I want to set up SQL Server on Windows XP Pro so that I can use the database capabilities of ASP and IIS. I am probably using some incorrect settings, but I am not sure what they are. Here is what...
9
669
by: Grim Reaper | last post by:
My work let me put SQL Server 7.0 Enterprise Edition on my laptop. I have never setup a server from the beginning, so I am a little new at creating server groups. Alright, I am trying to create...
0
2790
by: Chris Halcrow | last post by:
Hi I've spent ALL DAY trying to re-install SQL Server 2000 on Windows XP. I continually get the error 'cannot configure server' just at the end of the installation. I've tried the following: ...
0
4506
by: Zorba.GR | last post by:
IBM DB2 Connect Enterprise Edition v8.2, other IBM DB2 (32 bit, 64 bit) (MULTiOS, Windows, Linux, Solaris), IBM iSoft Commerce Suite Server Enterprise v3.2.01, IBM Tivoli Storage Resource Manager...
22
3236
by: EP | last post by:
When running my asp.net hosting service (asp.net without IIS), on server 2003 with IIS not installed, I get the following when trying to process a request. "System.DllNotFoundException: Unable to...
4
7281
by: coosa | last post by:
Hi, I was installing SQL Server on my machine and during installation my PC freezed. It happens frequently on my machine. So i tried after restarting to install it again and since then i always...
1
6591
by: Peter | last post by:
I've purchased VS.NET 2005 Standard and have tried to install SQL Server 2005 Express, but get the following error in the error log. Please could someone help me.... Microsoft SQL Server 2005...
14
6994
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
14
2999
by: Developer | last post by:
Hello All, i have recently installed VS2005 and was trying to install SQL sever 2000. I have Win XP' SP2. But when I tried installing, it only installed client tools and not the database. Can...
0
7099
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7123
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5430
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4864
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.