• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 362
  • Last Modified:

first character of the textbox should not special character in RegularExpressionValidator

First character of the textbox should not special character, what code I have to write  in ValidationExpression= "  " of  RegularExpressionValidator
0
Tapan Pattanaik
Asked:
Tapan Pattanaik
  • 2
  • 2
1 Solution
 
Carl TawnSystems and Integration DeveloperCommented:
Try:
'/^[a-zA-Z0-9].*$/'

Open in new window

0
 
Tapan PattanaikSenior EngineerAuthor Commented:
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
 
Carl TawnSystems and Integration DeveloperCommented:
OK, try it as:
^[A-Za-z0-9].*

Open in new window

0
 
Tapan PattanaikSenior EngineerAuthor Commented:
100% working. Thank You so much.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now