Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

page load after postback - how does it know?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
oaksong - 28 Mar 2008 20:41 GMT
Looking at the locals I have "ME" and "sender". I've just clicked on a
dropdownlist and it's fired a post back. I'm in the page_load. I know
that after the page_load is complete it will fire the click event
handler for my dropdownlist, which indicates, since I've got several
of these, that it knows which one fired.

The question is: How does it know? Is there something in "Me" or
"sender" that tells it what I clicked on? This seems to me to be a
fairly rudimentary question, yet I'm not having any luck finding an
answer via the usual search mechanisms.

tia
Chris
Alexey Smirnov - 28 Mar 2008 22:12 GMT
> Looking at the locals I have "ME" and "sender". I've just clicked on a
> dropdownlist and it's fired a post back. I'm in the page_load. I know
[quoted text clipped - 9 lines]
> tia
> Chris

When a page submits a form, .NET will implement the
IPostBackEventHandler interface. This interface defines the
RaisePostBackEvent method which is receiving the data from the control
and will get fired when a postback is triggered. This method depends
on the type of the control and will look up for an associated event
handler to run it.

See more in The ASP.NET Page Object Model article:
http://msdn2.microsoft.com/en-us/library/aa479007.aspx
bruce barker - 28 Mar 2008 23:48 GMT
its pretty simple. a control implements the IPostBackEventHandler interface.
that control then renders some javascript that will do the postback. the
javascript call includes the control name and arguments. this are stored in a
hidden field, then a submit is done.

on the server side, on a postback, if the postback event hidden field
contains a value, it looks up the control with that id, and calls the
IPostBackEventHandler method. the control then decides how to fire the event
itself, and what to pass.

-- bruce (sqlwork.com)

> Looking at the locals I have "ME" and "sender". I've just clicked on a
> dropdownlist and it's fired a post back. I'm in the page_load. I know
[quoted text clipped - 9 lines]
> tia
> Chris

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.