Hey Buddies!
Please let me know, how to show alert message in web forms (in a catch block)?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Dipankar BiswasPosted Jul 31, 2014, 7:06 AM
{
MessageBox.Show(e.Message);
}
or...
private void Btn_Click(object sender, EventArgs e)
{
try
{
int a = 10;
int b = 0;
int r = a/b;
}
catch (Exception exception)
{
String scriptText = "alert('Error - " + exception.Message + "')";
ClientScript.RegisterOnSubmitStatement(this.GetType(),
"ErrorAlert", scriptText);
}
}
or..
catch
{
Response.Write("");
Response.Write("")
;
}