How to call a JavaScript alert from a static method in C#?
I have tried the following code but the method does not get called.
public static void WriteToErrorLog()
{
Page mypage = new Page();
ErrorMessage(mypage);
}
public static void ErrorMessage(Page page)
{
page.ClientScript.RegisterStartupScript(typeof(Page), "alert", "<script type='text/javascript'>alert('Oops something went wrong, please try later...!!');</script>");
}
Response.Write("<script>alert('Oops something went wrong, please try later...!!');</script>");Pagethat disappears when it goes out of scope..