Posts

Showing posts from March, 2010

__doPostBack Function

Introduction It is quite amazing to note that only two of the ASP.NET web server controls cause a postback. All the other controls use the JavaScript __doPostBack function to trigger the postback. In this article you will learn about the __doPostBack function and how it works. _doPostBack Function The best way to understand the working of the __doPostBack function is to dissect the function into small pieces and explore each piece one at a time. Let us take a look at the function. Listing 1 - _The __doPostBack function function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } Analysis The __doPostBack function takes two arguments, eventTarget and eventArgument. The eventTarget contains the ID of the control that causes the postback and the eventArgument contains any additional data associated with the control. Note that...