title: Calling JavaScript alert from a static method in C#
body: <p>How to call a JavaScript <code>alert</code> from a static method in C#?</p>
  
  <p>I have tried the following code but the method does not get called.</p>
  
  <pre><code> public static void WriteToErrorLog()
   {   
       Page mypage = new Page();
       ErrorMessage(mypage);                
   }
   public static void ErrorMessage(Page page)
   {
       page.ClientScript.RegisterStartupScript(typeof(Page), "alert", "&lt;script type='text/javascript'&gt;alert('Oops something went wrong, please try later...!!');&lt;/script&gt;");
   }
  </code></pre>