ASP.NET RequiredField RegularExpression Triggering After Page Postback

Last Reply on Jul 12, 2019 12:06 AM By pandeyism

Posted on Jul 09, 2019 04:05 AM


In my registration i am having around 10 fields as textbox dropdownlist and fileupload and also a submit button. When I click on submit button the validations are not triggering also page is posting back and then validations getting triggered. why.

I have used Master page and used Toolscriptmanager for ajax calendar.

Results 1 - 5 of 9 12
Posted on Jul 12, 2019 12:06 AM

Hi Sumeet,

If your question has beed solveed do please mark it as answered.

Posted on Jul 12, 2019 12:03 AM

Got a solution. While after googling for long hours I am got that I would need to add another property in every asp validations as EnableClientScript and should be set to True.

Posted on Jul 11, 2019 05:16 AM

Hi Sumeet,

I checked again code which is working. if still not working so share your complete code with us.

Posted on Jul 11, 2019 01:10 AM Modified on on Jul 11, 2019 01:12 AM

Sir the problem is still there. I have made another form in another tab but there also there is a same problem. Button causing page postback without triggering validations. 

Validations are firing after page postback.

Posted on Jul 09, 2019 05:55 AM Modified on on Jul 09, 2019 05:56 AM

Hi  Sumeet,

I checke your code is validation for all control except dropdowlist. so for validation dropdownlist replcae below code with your code.

You need to add below line of code.

dropdownclassrecoganized.Items.Add(New ListItem("--Select--", "0"))


Public Sub loadclassrecog()
    Dim i As Integer = 0
    dropdownclassrecoganized.Items.Add(New ListItem("--Select--", "0"))
    Using con As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("constr").ConnectionString)
        Using cmd As SqlCommand = New SqlCommand("Select * from Customers", con)
            Dim dr As SqlDataReader = cmd.ExecuteReader()
            While dr.Read()
                i += 1
                dropdownclassrecoganized.Items(i).Value = dr("CustomerId").ToString()
            End While
        End Using
    End Using
End Sub