Showing a Confirmation message on submit button using JavaScript

Posted by vishalneeraj-24503 under JavaScript category on | Points: 40 | Views : 1067
Whenever user submit the data,we need a confirmation (Yes/No) message before submit the data into the server.
Use OnClientClick event of clientside event of Button control as:-

<asp:Button ID = "btn_delete" OnClientClick = "javascript:return confirm('Are you sure you want to Delete?')" 
runat = "server" Text = "Delete" />

When user clicks the Submit button,confirmation message box will display with OK and Cancel button.By clicking OK to submit the data into server,clicking Cancel will stop the post back.

Comments or Responses

Login to post response