Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
i want to dispaly message box using java script on clicked on button that "Data Saved Sucessfully".
Regards
Manohar Khilare
Posted 24-Jan-13 2:42am
Comments
Vani Kulkarni at 24-Jan-13 7:51am
   
ok, so what is the question?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hello freind,
 
if you want to show message after finishing your work from code behind then use this syntax at the end of your buttong click event last line.
 
protected void btnJavasctiptAlert_Click(object sender, EventArgs e)
{
     //other work code here
     //like insert data code goes here
     ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "anything", "alert('Data Saved Sucessfully');", true);
}
 
or just simply want to add javascript mesage from design side then use like this...
 
<asp:button id="btn" runat="server" text="Javascript Click" onclientclick="javascript:alert('Data Saved Sucessfully');" xmlns:asp="#unknown" />
  Permalink  
Comments
ridoy at 24-Jan-13 13:35pm
   
+5
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

A pretty vague question. But still here's I think what you can do.
 
I'm pretty sure you want to show this message after actually saving the data...Smile | :) If you are saving the data asynchronously using jquery or .Net Page methods...you can write your code at the end of success method.
 
You can use jquery dialog for showing the message. It's pretty easy to implement also.
 
<asp:button id="btn" runat="server" text="Javascript Click" onclientclick="javascript:SaveData(a);" xmlns:asp="#unknown" />
 
<script>
 
function SaveData(a){
if (typeof a !== "undefined"){
   PageMethods.SaveData(a,savesuccess,savefailed);//you can use the jQuery syntax also here if you are using webservice to save the data.
}
}
function savesuccess(){
    alert('Data Saved');
}
function savefailed(){
   alert('Save Failed');
}
</script>
 
If this is not what you are looking perhaps changing the question would help. Smile | :)
  Permalink  

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

  Print Answers RSS
0 Maciej Los 372
1 ridoy 313
2 DamithSL 305
3 OriginalGriff 209
4 George Jonsson 140
0 OriginalGriff 7,968
1 DamithSL 6,179
2 Sergey Alexandrovich Kryukov 5,524
3 Maciej Los 5,438
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 24 Jan 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