Click here to Skip to main content
15,908,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When someone click the Save button, i want to validate some input details with database and if the validation return something from the database, show the popup window with Yes or No, if Yes then proceed.

1 solution

Have a look at this code:
<asp:button id="save" runat="server" text="Save" onclick="save_Click" onclientclick="return confirm('Are you sure you want to save selected records?');" />

This code will ask you to confirm the action,if you press yes,then only save_Click will be executed.


\\Do your calculations here

if(your condition1)
  Response.Write("<script type='text/javascript'>");
  Response.Write("alert('This is alert1 if condition1 satisfied.');");
  Response.Write("<script type='text/javascript'>");
  Response.Write("alert('This is alert2 if condition1 does not satisfy.');");

Share this answer
Robymon 18-Jun-13 4:58am    
This code will work when we click the button, i want to show the Message after the Validation and the Button click
Thanks7872 18-Jun-13 5:02am    
You can do such that,make calculations in save_click and then show alert based on that,but that would be alert box only,if you want that,then let me know.
Robymon 18-Jun-13 5:14am    
Yes, i want the alert box, please give me some sample code
Robymon 18-Jun-13 5:34am    
How to write this above code in the Updatepanel page?
Thanks7872 18-Jun-13 5:41am    
This code will be in code behind(.cs) file of your page. Updatepanel will be in your main page(.aspx).This code will be in save_click in our case.(remember to put save button outside the panel)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900