Click here to Skip to main content
13,046,281 members (118,794 online)
Rate this:
Please Sign up or sign in to vote.
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.
Posted 17-Jun-13 22:30pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.');");

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
Rohan Leuva 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?
Rohan Leuva 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 18 Jun 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100