I am trying to do some error handling in item inserting for my formview. If anyone forgets to enter a value in tutorial section, the error message will detect it is null and give a popup of it being null. however, my visual studio does not recognize Exception or ExceptionHandled. The error is that there is no definition for Exception. I have searched high and low and I don't know what the problem is. Any ideas will be appreciated.
protected void FormView1_ItemInserting(object sender, FormViewInsertEventArgs e)
{
if (e.Exception != Null)
{
string msg = "";
if (e.Exception.Message.Containts("NULL"))
{
msg = "Tutorial Section cannot be empty.";
}
else
msg = "unknown";
ClientScript.RegisterStartupScript(this.GetType(), "myalert", "window.setTimeout(\"alert('" + msg + "')\",0);", true);
e.ExceptionHandled = true;
}
}