User-1499457942 posted
Hi
I am trying below code but error is not getting displayed if there is some error. For e.g i have written below line and it should display error on Client Side
Request.QueryString["tmp"] != "ABC"
try
{
con.ConnectionString = ConfigurationManager.ConnectionStrings["cnn"].ConnectionString;
if (Request.QueryString["tmp"] != null && Request.QueryString["tmp"].ToString() != "")
{
if (!Page.IsPostBack)
{
con.Open();
}
}
}
catch (Exception ex)
{
string message = ex.ToString();
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script type = 'text/javascript'>");
sb.Append("window.onload=function(){");
sb.Append("alert('");
sb.Append(message);
sb.Append("')};");
sb.Append("</script>");
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString());
}
Thanks