Hanselman’s Interview: Postbacks

Explain how PostBacks work, on both the client-side and server-side. How do I chain my own JavaScript into the client side without losing PostBack functionality?

From StackOverflow: Postbacks are an abstraction on top of web protocols which emulate stateful behavior over a stateless protocol. On the client side, postbacks are achieved by javascript calls and hidden fields which store the state of all controls on the page. The server side goes through a life cycle of events, port of that life cycle is the hydration of the viewstate to maintain the state of all controls on the page, and the raising of events based on the parameters that were passed into the __doPostBack call on the client side.

Depending on your requirements, you can use control events like OnClientClick to chain in your client side JavaScript, or you can use the GetPostBackEventReference method to give your scripts access to the postback method on the client side.