troubleshooting Question

RegularexpressionValidator Numeric Only, dash, size greater 3 bytes

Avatar of Hojoformo
Hojoformo asked on
1 Comment1 Solution660 ViewsLast Modified:
How can I create a ASP.NET regularexpressionvalidator control for a required field that needs to be numeric, size greater than 3 btyes and can have a dash "-".  For example:


Here is what I have so far but it does not work.  

<asp:TextBox id=m_AccountNumber Runat="server" CssClass="BodyContent" Width="100">                                                                            </asp:TextBox>

<asp:RegularExpressionValidator id="m_AcctNumValidator2" Runat="server" ControlToValidate="m_AccountNumber" CssClass="ErrorMessage" ErrorMessage="Not Valid-Numeric Only" ValidationExpression="^[0-9]-">                                                                    </asp:RegularExpressionValidator>

<asp:RequiredFieldValidator id=m_AcctNumValidator Runat="server" CssClass="ErrorMessage" ErrorMessage="Required." ControlToValidate="m_AccountNumber">           </asp:RequiredFieldValidator>

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros