Problem solve Get help with specific problems with your technologies, process and projects.

What does the PostBack method do?

What does the PostBack method really do? Why do we use it, when do we use it, and where do we use it?
Postback works by registering a javascript function named __doPostBack emitted by ASP.NET. This function is called by controls that cause postbacks, and causes the page form to be submitted to the server. This function is called passing the ID of the control causing the postback, and an optional argument to pass to the server-side event handler if it exists.

A server-side control can associate a client-side event to this function so that a postback is forced, for example, the "onclick" event on a control such as an image or a link.Your own custom controls can also participate in this process. You only have to use the Page. GetPostBackEventReference(Control control, string argument) method to render the call to the JavaScript client-side function. You also need to implement IPostBackEventHandler so that your control gets called whenever the postback function is called. You have to implement that interface method with the signature:
void RaisePostBackEvent(string eventArgument);
And you use postbacks automatically everytime you attach to an event on a server control.

Dig Deeper on Win Development Resources

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.