Solved

first character of the textbox should not special character in RegularExpressionValidator

Posted on 2014-03-12
4
347 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Call a VB.net function in Javascript 6 51
Call to SQL server times out 5 55
Make borderless form movable by user 2 27
How to strip HTML from this JS code using regex 29 46
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

751 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