Click here to Skip to main content
Rate this: bad
good
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
Robymon1.2K

1 solution

Rate this: bad
good
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>");
}
else
{
  Response.Write("<script type='text/javascript'>");
  Response.Write("alert('This is alert2 if condition1 does not satisfy.');");
  Response.Write("</script>");
}
Regards..Smile | :)
  Permalink  
v7
Comments
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 OriginalGriff 280
1 Sergey Alexandrovich Kryukov 279
2 CPallini 205
3 Maciej Los 197
4 Afzaal Ahmad Zeeshan 160
0 OriginalGriff 5,635
1 DamithSL 4,496
2 Maciej Los 3,942
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 18 Jun 2013
Copyright © CodeProject, 1999-2014
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