Click here to Skip to main content
15,900,461 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
Hello Sir,

I need to add capital lettors only in textbox? I mean via regular expression?




Thanks & Regards
Shamna
Posted
Comments
Sergey Alexandrovich Kryukov 14-Feb-12 23:07pm    
Not clear. How a TextBox and Regular Expressions related? What's on input?
(Because just adding capital letters could not be a problem.)
Better yet, learn Regular Expressions properly, and them ask a question, only if you fail to do something...
--SA

Dear Friend,

I think this link is the solution to your problem:-

http://social.msdn.microsoft.com/Forums/eu/csharpgeneral/thread/a61ef305-eb20-4691-b535-e83c0a3ba629[^]

I hope this will help you out. Don't forget to mark this as your answer.

Thanks
 
Share this answer
 
Hi,

You can do it by applying CSS to the text box.

like,

HTML
<style>
.upper
{
	text-transform:uppercase ;
}
</style>



then calling Css in Text box,

ASP.NET
<asp:textbox id="txtName" runat="server" cssclass="upper" xmlns:asp="#unknown"></asp:textbox>




regards,
Pal
 
Share this answer
 
Comments
Ashika s 15-Feb-12 0:48am    
Thanks alot palraj
<asp:textbox id="txtInput" runat="server" xmlns:asp="#unknown"></asp:textbox>
 <script type="text/javascript">   
  function setFormat() 
{     
    var inp = document.getElementById('ctl00_MainContent_txtInput'); 
    var x = inp.value;      
    inp.value = x.toUpperCase();   
  }      
var inp = document.getElementById('ctl00_MainContent_txtInput');
     inp.onblur = function(evt) {  
       setFormat();     
}; 
</script>
 
Share this answer
 
v2
Just try this:

<pre lang="HTML"><asp:TextBox ID="txtName" runat="server"/>
<asp:FilteredTextBoxExtender ID="fteLName" TargetControlID="txtName"
runat="server" FilterType="UppercaseLetters"
ValidChars=" "/></pre>

FilteredTextBoxExtender is a tool of ajax control toolkit..
All the best.. :)
 
Share this answer
 

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