|
Author: Jenny Nguyen
|
|
Learn how you could raise an alert from ASP.NET code using javascript message box. We use alert all the time to provide feedback to the website user or to inform them of a process going on in the background. Whatever reason you need to use it for here is a simple solution. In the code behind we could put the code as follow: void Page_Load(object sender, EventArgs e) btnFeedback.Attributes.Add("onclick", "javascript:alert('Thank you for your feedback.')"); If you need to display a message after post back complete then try this: ClientScript.RegisterStartupScript(this.GetType(), "UpdateCompleteAlert", "alert('The record has been updated.');", true); Did you like this article? Another option is to try this:
System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE=""JavaScript"">alert("Hello World!!!")</SCRIPT>")
|