checkvalidity() of employee ID field

Dec 6 2022 2:52 AM

how i can  checkvalidity of employye id . example of ID input : T00797

code: surveyform.aspx.vb

Imports System.Data.SqlClient
Public Class Surveyform
    Inherits System.Web.UI.Page
    Dim SqlConnection As String = ConfigurationManager.ConnectionStrings("RSTCqlConnection").ConnectionString

    Protected PollTitle As String
    Protected PollQues As String

    Dim PollID As String
    Dim no As String
    Dim total As String
    Dim nextQ As String
    Dim checkflag As String

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        loadques()
    End Sub
    Private Sub BtnStart_Click(sender As Object, e As EventArgs) Handles BtnStart.Click
        checkflagchecker()
        If checkflag <> "1" Then
            Session("SurveyId") = EmpID.Text
            Session("SurveyName") = EmpFullName.Text
            Response.Redirect("Surveyform.aspx?ques=1")
        Else
            PanelError.Visible = True
        End If
    End Sub

    Public Sub checkflagchecker()
        If EmpID.Text = "" Then
            checkflag = "1"
        ElseIf EmpFullName.Text = "" Then
            checkflag = "1"
        End If
    End Sub

code: default.aspx

Private Sub SubmitBtn_Click(sender As Object, e As EventArgs) Handles SubmitBtn.Click
    checkvalidity()
    If checkflag = "1" Then
        PanelsuggestionNotRecieve.Visible = True
        Panelmemo.Visible = False
    Else
        PanelsuggestionRecieve.Visible = True
        Panelmemo.Visible = False
        CreateNewForm()
    End If
End Sub

'check validity
'1 = Empty textbox
Public Sub checkvalidity()
    If name.Text = "" Then
        name.BorderColor = Drawing.Color.Red
        checkflag = "1"
    End If
    If EmpNo.Text = "7" Then
        EmpNo.BorderColor = Drawing.Color.Red
        checkflag = "1"

        If (EmpNo.TextMode = 7) Then
            EmpNo.Text = "invalid Employee num"
        End If


    End If
    If Email.Text = "" Then
        Email.BorderColor = Drawing.Color.Red
        checkflag = "1"
    End If
    If Form.Text = "" Then
        Form.BorderColor = Drawing.Color.Red
        checkflag = "1"
    End If
End Sub


Answers (1)