How to display an alert box from C# in ASP.NET?

moe picture moe · May 4, 2013 · Viewed 399.6k times · Source

I am using a detail-view and would like to display an alert-box at the end of my code block that says:

Thank you! Your data has been inserted successfully.

Is there a simple way to do this from the C# code behind of my ASP.NET web pages?

Answer

Mudassir Hasan picture Mudassir Hasan · May 4, 2013

After insertion code,

ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record Inserted Successfully')", true);