473,699 Members | 2,666 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PostBack NonPostBack Event order issue

On a webForm, I have a DropDownList with AutoPostBack=tr ue and I also
have couple textbox with AutoPostBack=fa lse.

I am expect that the DropDownList's SelectedIndexCh anged 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 2026
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=tr ue
2. A textbox - txtTwo, w/ AutoPostBack=fa lse
Both controls have their event handlers:
ddlOne_Selected IndexChanged, and
txtTwo_TextChan ged.

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_Selected IndexChanged is
alway before txtTwo_TextChan ged.

I understand why ddlOne_Selected IndexChanged 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
IPostBackDataHa ndler interface. The runtime tracks the controls that
return true to LoadPostData and Invoke the RaisePostDataCh angedEvent
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_Selected IndexChanged
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******@wowwa y.com> wrote in message
news:84******** *************** **@posting.goog le.com...
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=tr ue
2. A textbox - txtTwo, w/ AutoPostBack=fa lse
Both controls have their event handlers:
ddlOne_Selected IndexChanged, and
txtTwo_TextChan ged.

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_Selected IndexChanged is
alway before txtTwo_TextChan ged.

I understand why ddlOne_Selected IndexChanged 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
IPostBackDataHa ndler interface. The runtime tracks the controls that
return true to LoadPostData and Invoke the RaisePostDataCh angedEvent
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_Selected IndexChanged
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
3290
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
17041
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 control in my aspx page with two image buttons, one for an edit command, another a delete command. Here is a cut down code fragment. ...
0
2143
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 one of my ASP.NET 1.1 web forms. This involves a fairly simple inheritance of the System.Web.UI.WebControls.RadioButtonList class, with some new properties added and the Render sub overridden. When I come to render each radio item, I do the...
3
2752
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
14819
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 processed by the web server. I am still struggling to understand this postback logic, and hope that some kind gurus out there could help me clarify the confusion I have.
2
2173
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. -------------------------------------------------------------------------------- Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/in configuration or <%@ Page EnableEventValidation="true"...
1
1655
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 server. This worked fine in .NET 1.1 Now in ASP.NET 2.0 I get an error message: 'Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/in configuration or <%@ Page EnableEventValidation="true"...
2
3919
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 well, so at times it is tempting just to port parts of it over mostly as-is. In fact, one MSDN article I read suggested using straight HTML wherever possible to make the app more efficient and less resource demanding. On one page there are 2...
9
4556
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
8691
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9180
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9038
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8887
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7755
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6536
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3060
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2351
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.