I want to apply a regularexpressionvalidator to selective fields in DetailsView ASP.NET 2.0 VB

305 Views Asked by At

Hello, I have been having trouble with this for a while now. I have a bound textbox within a Detailsview, to which I have added a RegularExpressionValidator (REV). The Regular Expression used is [a-zA-Z]*

After running the Web Form, the Edit button opens the fields. Any entries made cause the REV error msg to be displayed when the Update button is pressed, irrespective of the validation. The Update button continues to be displayed until the Cancel button is selected and the original record is returned to the screen replacing any entries.

The RequiredFieldValidator works correctly.

Ray Brown

1

There are 1 best solutions below

0
On

I would suggest you FilteredTextBoxExtender of Ajax Control Toolkit instead of using REV.

It gives you the option to validate the input for many types of validation for numeric, letter, or even custom types for example:

<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>

<ajaxToolkit:FilteredTextBoxExtender ID="ftbe" runat="server"
    TargetControlID="TextBox3"         
    FilterType="LowercaseLetters, UppercaseLetters" />