Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C#2.0 ASP.NET
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 23: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.
D'Oh! | :doh: [EDIT]:
\\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.');");
Regards..Smile | :)
Robymon at 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 at 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 at 18-Jun-13 5:14am
Yes, i want the alert box, please give me some sample code
Robymon at 18-Jun-13 5:34am
How to write this above code in the Updatepanel page?
Rohan Leuva at 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
0 Peter Leow 293
1 Kornfeld Eliyahu Peter 220
2 Sergey Alexandrovich Kryukov 162
3 Maciej Los 160
4 OriginalGriff 153
0 OriginalGriff 383
1 Peter Leow 318
2 Kornfeld Eliyahu Peter 260
3 Maciej Los 230
4 Sergey Alexandrovich Kryukov 212

Advertise | Privacy | Mobile
Web03 | 2.8.150301.1 | Last Updated 18 Jun 2013
Copyright © CodeProject, 1999-2015
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