Subject: RegularExpression Validator
Posted By: monika.vasvani Post Date: 11/15/2006 4:53:18 AM
Hi All

I have added textbox in Datagrid in Itemdatabound event.I have fired runtime RegularExpression validator on every textbox.I wnt that when user enter 0 or any character then validator should be fired.How to set ValidationExpression?How can I do?I am not getting how to set ValidationExpression property?if u have any solution,Pls reply me.

Thanks
monika

Reply By: jlrolin Reply Date: 11/16/2006 3:54:38 PM
Monika,

The property is ValidationExpression. It is used by setting it equal to a regular expression, which in your case will stop the user from entering zero and any other character. Your regular expression will allow only positive integers. You can scour the Internet for regular expressions to stick into the ValidateExpression property.

Example:


<asp:RegularExpressionValidator id="RegularExpressionValidator1" runat="server"
            ControlToValidate="TextBox1"
            ValidationExpression="^\d{5}$"
            Display="Static"
            Font-Name="verdana" 
            Font-Size="10pt">
               Zip code must be 5 numeric digits
        </asp:RegularExpressionValidator>


Reply By: itsmanoj Reply Date: 1/8/2007 8:58:44 AM
HI,
I want to create a RegularExpressionValidator for a field such as it should be alphanumeric and should be only 15 digits long. Can you please help?

Go to topic 54502

Return to index page 70
Return to index page 69
Return to index page 68
Return to index page 67
Return to index page 66
Return to index page 65
Return to index page 64
Return to index page 63
Return to index page 62
Return to index page 61