Tuesday 24 September 2013

How to show the message in asp.net website using javascript.

In this article , I have explained how to show Message Box in asp.net website using javascript.I will also tell you how to solve error Message Box not working inside update panel. Message box is frequently used in asp.net application for showing the message.

In the code behind file(.aspx.cs ) write the below code:-

protected void btnSave_Click(object sender, EventArgs e)
    {

   ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Data Submitted Successfully');", true);

    }

If you are using Update panel then this code will not work.So please write the below code in code behind page.

protected void btnSave_Click(object sender, EventArgs e)
    {
        ScriptManager.RegisterStartupScript(this, this.GetType(), "Message", "alert('Data Submitted Successfully');", true);

    }

No comments:

Post a Comment

Note: only a member of this blog may post a comment.