Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 15th, 2006, 05:53 AM
Authorized User
 
Join Date: Jun 2006
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Default RegularExpression Validator

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

 
Old November 16th, 2006, 04:54 PM
Authorized User
 
Join Date: Jun 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to jlrolin Send a message via MSN to jlrolin
Default

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:

Code:
<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>
 
Old January 8th, 2007, 09:58 AM
Registered User
 
Join Date: Jan 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Validator expression Maxxim ASP.NET 1.0 and 1.1 Professional 1 December 3rd, 2006 07:07 AM
How to use validator in datagrid. dajay ASP.NET 1.0 and 1.1 Basics 0 August 8th, 2005 07:56 AM
Regularexpression vs w3c vohra_vikas2004 General .NET 0 November 19th, 2004 09:12 AM
RegularExpression Query vohra_vikas2004 General .NET 1 November 18th, 2004 09:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.