I have regular expression validation in a page which checks whether the entered value in the text box is a numeric, it is not numeric it gives error message says "it should be numeric"
but when i click on the next button of the form .. it navigates to the next page. But it shouldn't be. How to solve this?
Protected Sub btn_View1_Next_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_View1_Next.Click
Try
Dim currentView As Int16
currentView = mvRequestorForm.ActiveViewIndex
Dim rowsCount As Integer = gvRoleDepartment.Rows.Count
Dim checkCount As Integer = 0
''USERID Validation
lblUserExists.Text = String.Empty
rfvStoreNumber.Validate()
rfvStoreNumber.SetFocusOnError = True
rfvSurName.Validate()
rfvSurName.SetFocusOnError = True
''New USesr
If (ddl_view0_typeOfRequest.SelectedItem.ToString().ToLower().Equals("new")) Then
rfvEmplyeeNumber.Visible = True
If Page.IsValid Then
If currentView = 1 Then
mvRequestorForm.ActiveViewIndex = (currentView + 1)
rfv_view2_managersEmail.Enabled = True
rev_view2_managersEmail.Enabled = True
Else
mvRequestorForm.ActiveViewIndex = (currentView + 1)
End If
If currentView = 0 Then accountType = ddl_view0_typeOfRequest.SelectedItem.ToString()
If mvRequestorForm.ActiveViewIndex = 1 Then
Sub_ActivateView1()
End If
End If
ElseIf ddl_view0_typeOfRequest.SelectedValue.ToString().ToLower().Equals("delete") Then
''Check the requirement
'rfvFirstName.Validate()
'rfvFirstName.SetFocusOnError = True
rfvUserID.Validate()
rfvUserID.SetFocusOnError = True
rfvEmplyeeNumber.Visible = True
If Page.IsValid Then
Dim dsRoles As New DataSet
dsRoles = SearchGroups(txtUserID.Text.Trim())
If Not sResult Is Nothing Then
lblUserExists.Text = String.Empty
If currentView = 1 Then
mvRequestorForm.ActiveViewIndex = (currentView + 1)
rfv_view2_managersEmail.Enabled = True
rev_view2_managersEmail.Enabled = True
Else
mvRequestorForm.ActiveViewIndex = (currentView + 1)
End If
If currentView = 0 Then accountType = ddl_view0_typeOfRequest.SelectedItem.ToString()
If mvRequestorForm.ActiveViewIndex = 1 Then
Sub_ActivateView1()
End If
Else
lblUserExists.Text = String.Format("This userid doesn't exist. Please enter a valid user id.")
Return
End If
End If
Else
''Update User
rfvUserID.Validate()
rfvUserID.SetFocusOnError = True
rfvEmplyeeNumber.Visible = True
If Page.IsValid Then
Dim dsRoles As New DataSet
dsRoles = SearchGroups(txtUserID.Text.Trim())
If Not sResult Is Nothing Then
lblUserExists.Text = String.Empty
If currentView = 1 Then
mvRequestorForm.ActiveViewIndex = (currentView + 1)
rfv_view2_managersEmail.Enabled = True
rev_view2_managersEmail.Enabled = True
Else
mvRequestorForm.ActiveViewIndex = (currentView + 1)
End If
If currentView = 0 Then accountType = ddl_view0_typeOfRequest.SelectedItem.ToString()
If mvRequestorForm.ActiveViewIndex = 1 Then
Sub_ActivateView1()
End If
Else
lblUserExists.Text = String.Format("This userid doesn't exist. Please enter a valid user id.")
Return
End If
End If
End If
Catch ex As Exception
End Try
End Sub