Sunday, January 13, 2013

Telerik Tricks: Radconfirm with Button Click

Sometimes system requires user confirmation before submitting data or request to the server. Radconfirm is the stylish JavaScript popup which can use instead of standard confirmation. Radconfirm popup is non-blocking, that is radconfirm modal window do not block the execution thread. Because radconfirm window implemented using JavaScript and JavaScript not block the execution thread.  However server should wait until user selects one of the option shows in modal dialog box before submit the action to the server. To achieve that with radconfirm should block the button’s postback action until user confirms the action.

How block postback action of button?

Use OnClientClick action to hold button postback until user confirms. Following code snippet shows waiting mechanism of Submit button. If user clicks on the submit button it do not postback until evaluate function called “ConfirmationFunction”. If “ConfirmationFunction” return true then button continue the postback otherwise postback wont happened.






ConfirmationFunction is the JavaScript function which shows radconfirm modal dialog box and get user confirmation before submit. Following code snippet illustrate how get user confirmation and continue postback. Advantage of following mechanism is if same page contains several radpopup windows’ following mechanism does not overwrite the behaviors of other radconfirms, radalerts and radwindows.   






No comments:

Post a Comment