Page.ClientScript.RegisterStartupScript(GetType(), "Alert", @"<script language='javascript'>alert('" + ex.Message + @"');</script>");
Another Simple JavaScript Alert from Code Behind
ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "Alert", "alert('sometext*** sucessfully');", true);
ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "Alert", "alert('sometext*** sucessfully');", true);
HttpContext context = HttpContext.Current;
context.Response.Write("<script type='text/javascript'>if(window.frameElement!=null){window.frameElement.commitPopup();}else{window.close();}</script>");
context.Response.Flush();
context.Response.End();