Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello All,

I want to Convert Textbox value into Uppercase and it should be display in uppercase.

so I have just use
ASP.NET
<pre lang="xml"><asp:TextBox ID="txtno" runat="server" SkinID="text" MaxLength="19" onblur="this.value=this.value.toUpperCase();"></asp:TextBox>



and I have apply RegularExpressionValidator on that textbox & display error message through Validatorcallout Extender,

its working in IE but when i press tab/click anywhere its display error message but textbox fullfil critria but its always display error message ,

Please suggest me..

XML
<asp:RegularExpressionValidator ID="revOAHCasNo" runat="server" ControlToValidate="txtno"ErrorMessage="Please enter OAH Case No in correct format." Display="None" SetFocusOnError="true"ValidationExpression="(FM-[a-z,A-Z]{4}\-[0-9]{2}\-[0-9]{2}\-[0-9]{5})"
                                                   ValidationGroup="valgrp"></asp:RegularExpressionValidator>
 <cc1:ValidatorCalloutExtender ID="vceOAHCaseNo" runat="server" TargetControlID="revOAHCasNo"WarningIconImageUrl="../Images/Error.png"></cc1:ValidatorCalloutExtender>

C#

Posted
Updated 27-Apr-12 1:37am
v2
Comments
VJ Reddy 27-Apr-12 7:35am    
What is the regular expression used? Can you please post it.
madhuri@mumbai 27-Apr-12 7:38am    
I have added in question

I think this ought to work:
XML
\D{3}-\D{3}
or
([A-Z]{3}\-){2}[A-Z]{4}\-\d{5}\-\d{4}
 
Share this answer
 
v3
I would try :
ASP.NET
<asp:RegularExpressionValidator ... ValidationExpression="^FM-[a-z,A-Z]{4}\-[0-9]{2}\-[0-9]{2}\-[0-9]{5}$"/>


You don't need grouping function here (as you do when you enclose your expression in parenthesis) ; Matching is supposed to be on the entire textbox content. Thus the use of ^ (beginning of line or string) and $ (end of line or string).

If that doesn't make the trick, then having the error message itself could help.
 
Share this answer
 
Comments
madhuri@mumbai 27-Apr-12 7:59am    
Sorry ,
But its not applicable for that,
I want to say that,its fullfill criteria of RegularExpession but its alway display message on onblur event.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900