473,394 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

PostBack NonPostBack Event order issue

On a webForm, I have a DropDownList with AutoPostBack=true and I also
have couple textbox with AutoPostBack=false.

I am expect that the DropDownList's SelectedIndexChanged event being
handled after the textboxs' TextChanged event since this is the one
that cause the PostBack.

But I got the DropDownList's event first.

Reading the document, I noticed it only mention all the change event
are handled in NO particular order, the the CLICK event that CAUSE the
POST is processed. So I can't complain much but it would be nice the
see the any event that CAUSE the post is handled last.

John
Nov 18 '05 #1
5 2019
John Hi,

I'm little bit confused. ASP.NET post back architecture is build on two
hidden field that hold the control ID and optionally parameters that
cause post back. The server side now which control and event to call by
the hidden field that holds specific control ID thus just one event can
be call per post back. Each post back the page initialize and the PAGE
events are called before the request control event.

So I cant see how you can get events of combo box and textboxes on the
server side. You also mention that you set the textboxes autopostback to
false so they don't trigger any postback at all.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2
Natty,

Thanks for the response, I may not user correct terms. Here is my
prolem w/ example.

On the webform, I have:
1. A dropdownlist/combo box - ddlOne, w/ AutoPostBack=true
2. A textbox - txtTwo, w/ AutoPostBack=false
Both controls have their event handlers:
ddlOne_SelectedIndexChanged, and
txtTwo_TextChanged.

I first enter some text in txtTwo. The TextChange is NOT fired
immediately because AutoPostBack is set to false. Then I select an
item from the ddlOne. And this CAUSE the POSTBACK.

Now look at the order of the events - ddlOne_SelectedIndexChanged is
alway before txtTwo_TextChanged.

I understand why ddlOne_SelectedIndexChanged happen first because
ddlOne is put one the form first. It DOESN'T MATTER who cause the
postback. Both events are StateChange event that implement the
IPostBackDataHandler interface. The runtime tracks the controls that
return true to LoadPostData and Invoke the RaisePostDataChangedEvent
in the order of the controls on the form.

So this is by design not a bug but a challenge for me. I want the
TextChanged event happen first because the ddlOne_SelectedIndexChanged
need the outcome the the text.

Or, is there any Event that I can be sure is the LAST event that I can
use?

Thanks again.

John
Nov 18 '05 #3
PreRender is the last event, where you can still change page rendering

-- bruce (sqlwork.com)
"Q. John Chen" <no******@wowway.com> wrote in message
news:84*************************@posting.google.co m...
Natty,

Thanks for the response, I may not user correct terms. Here is my
prolem w/ example.

On the webform, I have:
1. A dropdownlist/combo box - ddlOne, w/ AutoPostBack=true
2. A textbox - txtTwo, w/ AutoPostBack=false
Both controls have their event handlers:
ddlOne_SelectedIndexChanged, and
txtTwo_TextChanged.

I first enter some text in txtTwo. The TextChange is NOT fired
immediately because AutoPostBack is set to false. Then I select an
item from the ddlOne. And this CAUSE the POSTBACK.

Now look at the order of the events - ddlOne_SelectedIndexChanged is
alway before txtTwo_TextChanged.

I understand why ddlOne_SelectedIndexChanged happen first because
ddlOne is put one the form first. It DOESN'T MATTER who cause the
postback. Both events are StateChange event that implement the
IPostBackDataHandler interface. The runtime tracks the controls that
return true to LoadPostData and Invoke the RaisePostDataChangedEvent
in the order of the controls on the form.

So this is by design not a bug but a challenge for me. I want the
TextChanged event happen first because the ddlOne_SelectedIndexChanged
need the outcome the the text.

Or, is there any Event that I can be sure is the LAST event that I can
use?

Thanks again.

John

Nov 18 '05 #4
Hi,

I think I understood you. the event order set by the control order in
page HTML. if you place combo and text box and the textbox is before the
listbox. the textbox event will fired first. change the order and the
listbox event will be fired first.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #5
Yes, PreRender works for me. Thank you both.

- John
Nov 18 '05 #6

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

Similar topics

10
by: Adam Clauss | last post by:
I have a page containing a list box. This list may contain duplicate items - in which the ORDER is important. ex: a b b a is significant as compared to: b
1
by: Timbo | last post by:
Hi all, This is my first message here so i'll try and include all the information that will help you help me out, if possible. Basically I am using C# in ASP.NET 2.0 and have a Repeater...
0
by: webmaster | last post by:
Hi all, I'm tearing my hair out with this one. I have successfully implemented by own RadioButtonList in order to provide additional functionality and a DIV rather than TABLE-based layout in...
3
by: teo | last post by:
Mozilla error on postback and validation ----------- A Button causes a Listbox to desappear. If no item has been selected on the Listbox, all is OK. If one or more items are selected,
11
by: antonyliu2002 | last post by:
I know that this has been asked and answered thousands of times. As a matter of fact, I know that I need to say If Not Page.IsPostBack Then 'Do something End If for things that needs to be...
2
by: Nathan Sokalski | last post by:
I have a DataList in which the ItemTemplate contains two Button controls that use EventBubbling. When I click either of them I receive the following error: Server Error in '/' Application....
1
by: Andreas Bergmeier | last post by:
Hi. Is there some KB article how to use EnableEventValidation when doing customized posts? Basicly we're building a post string via javascript and issue it via means of XMLHttpRequest to the...
2
by: John Kotuby | last post by:
Hi guys, I am converting a rather complicated database driven Web application from classic ASP to ASP.NET 2.0 using VB 2005 as the programming language. The original ASP application works quite...
9
by: 200dogz | last post by:
Hi guys, I want to have a button which opens up a new window when pressed. <asp:Button ID="Button1" runat="server" Text="Open new window" /> ... Button1.Attributes.Add("OnClick",
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.