I am trying to created a form that will allow a member to enter their member number in the text field and press the enter key to send it to the database for verification of membership. If the members number is valid it timestamps the time they entered, if the number is invalid it returns a message letting them know it expired.
I have the valid number process working, but not the invalid numbers. When an invalid number is entered it crashes the page. In the dump how ever is the error message from the stored procedure that I would like to display on the page and return the focus to the text field for the next entry.
This is what I get back when entering an invalid member number.
[SqlException (0x80131904): This badge number is invalid, please see the Membership Desk.]
What am I missing here, thanks in advance.
protected void Page_Load(object sender, SqlDataSourceStatusEventArgs e)
// done only during initialization
TextBox tbox = (TextBox)frmSignIn.FindControl("txtEnrollNumber");
Button btn = (Button)frmSignIn.FindControl("btnSubmit");
this.form1.DefaultFocus = tbox.UniqueID;
this.form1.DefaultButton = btn.UniqueID;
// done only during postback
Label lblErrMsg = (Label)form1.FindControl("lblErrorMessage");
if (e.Exception != null)
lblErrMsg.Text = "";
lblErrMsg.Text = e.Exception.Message;
e.ExceptionHandled = true;