event chain in asp.net

P

Paul F

Im interested in knowning how the web control event gets passed to
server and how its processed there.

Like how the click event of a web control button gets called for example

any sort of e-resource that would explain that?
 
B

bruce barker

its really pretty simple.

a control that fires a server click has javascript code that does a
postback (the browser posts all form data) to the server. the exception
is the imagebutton and button which do not require any javascript unless
they are performing validation. the javascript places the name of the
control (and the cmdarg value) in a hidden field before the postback.

the serverside code processes the postback, after page load, it checks
for a control name in the hidden field, it then looks for a control with
that name. if the control implements, IPostBackEventHandler, it calls
RaisePostBackEvent, which is where the control decides what type of
event to raise. Normally the server control will define an event
delegate and call it.

there is a simular approach for postback data handling. the control
implements an inteface (IPostBackDataHandler), is is called with the
postback data, update its self and returns a flag if any data change
events need calling. the page processor will call the handler and the
control will raise the event.

a browser page postback consists of a named value collection of all
browser form fields (<input>, <select> and <textarea>) contained in the
<form> doing the submit. the format is pretty simple:

<fieldname1>=<fieldvalue1>&<fieldname2>=<fieldvalue2>&

the names and values are urlencoded to handle imbedded special characters.

a browser submit button or image button will add itself to the list if
clicked (the image button actually sends a x and a y value via
buttonname_x and buttonname_y). this is how the server tells if one of
them caused the postback.


-- 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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top