VB.NET/ASPX Checking if Regex Control Validates

Soldato
Joined
1 Feb 2006
Posts
8,188
Hi,

I have a regular expression validator on my webform and I am having trouble catching the control when it is invalid - what I want to do is the following:

Check if a given textbox validates against the regex
If so then do something
If the control is not validated then do something else

I have tried the following to validate the controls but it doesn't work

Code:
SearchFieldRegex.Validate()
If Not SearchFieldRegex.IsValid Then
  Do Something
Else 
  Do Something Else
End If

Any ideas how I can detect whether the control is valid or not and execute some code based on the result? Sorry haven't explained it well but its the best I can do.
 
thanks a lot - managed to get it working last night anyways - I changed my code to run a page.validate() on certain events and then the isvalid() seemed to work. The second part of this was to capture this event using javascript also which was fun but eventually got there with document.getElementById('controlname').getAttribute("isvalid")

Thanks again
 
Back
Top Bottom