I had to do a JavaScript confirmation before I perform the post back on a web form. What I have done is just  call button.attributes.add("onClick", -- ) and added the confirmation.   It worked fine and showed the popup and did the post back if I clicked on the OK button. But if I have implemented some validations on the fields they doesn't fire them if the validation fails. For example if there is a required field validator the post back happens even without the values for that required field.   what I want is to do the validation and then do the post back. Luckily I've found a solution at  http://forums.asp.net/t/963412.aspx?PageIndex=1  by  sukdeb .   function Validate() {     var yes=confirm("Update this application?");     if(yes)     {         Page_ClientValidate();         return Page_IsValid;     } return false;  } <asp:button runat="server" text="Button" onc...