Solved

RequiredFieldValidator/RegularExpression

Posted on 2009-07-07
3
278 Views
Last Modified: 2012-05-07
Hi,

I need a requiredfieldValidator / regularExpressValidator which accepts only digits and it should accept
6 to 7 numbers typed in a textbox

for eg : 898838 (valid) or 9282798    (anything less than 6 or greater than 7 should throw error)


thanks in advance.
0
Comment
Question by:dotnet0824
  • 2
3 Comments
 
LVL 5

Assisted Solution

by:dumpsterdivingdave
dumpsterdivingdave earned 100 total points
ID: 24794726
0
 
LVL 3

Expert Comment

by:Michal-Drozd
ID: 24794744
try this:
<asp:RegularExpressionValidator ID="revPhoneNumber" runat="server" ControlToValidate="????" ErrorMessage="Enter Valid Number" ValidationExpression="[0-9]{6,7}"></asp:RegularExpressionValidator>

Open in new window

0
 
LVL 3

Accepted Solution

by:
Michal-Drozd earned 150 total points
ID: 24794788
I give you a little explanation for my above solution for better understanding:

Important is: ValidationExpression="[0-9]{6,7}"

this means to take only digits 0-9, and number of these digits is from 6 to 7
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question