Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

first character of the textbox should not special character in RegularExpressionValidator

Posted on 2014-03-12
4
Medium Priority
?
353 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 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
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…
Suggested Courses

885 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