Opening Confirmation box from server side

Dheeraj Kumar Gunti

Reading Time : ( words)

Following are the events used in opening confirmation box from server side.

  • ClientScript.GetPostBackEventReference
  • ClientScript.RegisterStartupScript
  • _doPostBack
ClientScript.GetPostBackEventReference: Returns a string that can be used in a client event to cause postback to the server.
ClientScript.RegisterStartupScript: Registers the startup script with the Page object.
_doPostBack: It is ASP.NET's way of doing javascript postbacks .

The first argument is eventTarget, which is the control that is triggering the action.
The second argument is event args means any additional information you might want to send with your postback.
Following is the example for opening up confirmation box










In the button submit event handler we are rendering a string to the client as javascript code. When user clicks on Ok automatically _dopostback event will be called in javascript and postback will take place and this is due to ClientScript.GetPostBackEventReference. In _doPostBackevent we are having two parameters, one the event target and other event arguments. Here in the above example “ConfirmationPostBackevent” is the eventTarget name and “Testing” will be the eventArgument.