page load after postback - how does it know?

O

oaksong

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
 
G

Guest

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

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
 
B

bruce barker

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,160
Latest member
CollinStri
Top