Solved

first character of the textbox should not special character in RegularExpressionValidator

Posted on 2014-03-12
4
339 Views
Last Modified: 2014-03-12
First character of the textbox should not special character, what code I have to write  in ValidationExpression= "  " of  RegularExpressionValidator
0
Comment
Question by:Tapan Pattanaik
  • 2
  • 2
4 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 39923261
Try:
'/^[a-zA-Z0-9].*$/'

Open in new window

0
 
LVL 21

Author Comment

by:Tapan Pattanaik
ID: 39923283
It is not working. Please check the code.

VALID: Test VALID: Hello123
 VALID: 456 Hi
 VALID: 456-789
 VALID: Hi-777
 VALID: 333-Hi
 VALID: Hello-There
 VALID: What's Up
 VALID: Hello#Goodbye
 
INVALID: -Hello
INVALID: &Goodbye


                                            <asp:RequiredFieldValidator ID="refName" runat="server" ErrorMessage="Enter Name"
                                                ControlToValidate="txtName" Display="Dynamic" CssClass="valMsg"></asp:RequiredFieldValidator><asp:RegularExpressionValidator
                                                    ID="revtxtName" runat="server" ErrorMessage="Invalid Name" ControlToValidate="txtName"
                                                    Display="Dynamic" ValidationExpression="/^[a-zA-Z0-9].*$/" CssClass="valMsg"></asp:RegularExpressionValidator>

Open in new window

0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 39923372
OK, try it as:
^[A-Za-z0-9].*

Open in new window

0
 
LVL 21

Author Closing Comment

by:Tapan Pattanaik
ID: 39923531
100% working. Thank You so much.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now