473,748 Members | 9,931 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 2034
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
3303
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
17044
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
2154
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
2759
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
14828
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
2175
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
1661
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
3926
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
4564
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
8831
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9325
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9249
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...
1
6796
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
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4876
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3315
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
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.