I am using this code block from a previous SO post showing ClientScript Alerts before Redirecting to another page in ASP.NET c#? that will display an alert message in an aspx page before redirecting to another page. I modified this script to avoid the redirect part.
However, this page does a submit. How can I avoid doing a page submit?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
public class HTMLHelper
{
public static void jsAlertAndRedirect(System.Web.UI.Page instance, string Message,string url)
{
instance.Response.Write(@"<script language='javascript'>alert('" + Message + "'); </script>");
}
}
HTMLHelper.jsAlertAndRedirect(this, "This is an alert.");