Click here to Skip to main content
12,746,681 members (28,741 online)
Rate this:
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".
Manohar Khilare
Posted 24-Jan-13 2:42am
Vani Kulkarni 24-Jan-13 7:51am
ok, so what is the question?
Rate this: bad
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" />
ridoy 24-Jan-13 13:35pm
Rate this: bad
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...:) If you are saving the data asynchronously using jquery or .Net Page 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" />


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

If this is not what you are looking perhaps changing the question would help. :)

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.170215.1 | Last Updated 12 Feb 2016
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