ISSUE :
 
Profile photo
Submitted by Sunil Sharma
on August 10th, 2011 at 12:42:07 EST

force ASP.NET Textbox to input Uppercase letter only.

I need to get ASP.NET textbox input as upper case only. I can convert the text input in the server-side code to convert to upper case only using String.ToUpper() but I also want to display upper case only regardless if user type in uppercase or lowercase. Is there any property that I can set in my ASP.NET textbox control to uppercase only?


Profile photo
Replied by SBajra
on August 10th, 2011 at 12:46:27 EST
You can display uppercase only in asp.net textbox control by applying style sheet
style="text-transform:uppercase;"

Then with your server side you will continue to convert actual text to uppercase. This will take care of both display and actual data.
Accepted Answer
Accepted
 Answer

Profile photo
Replied by Sunil Sharma
on August 10th, 2011 at 13:54:30 EST
Thanks for the suggestion. This works.

Profile photo
Replied by Johns Johns
on July 4th, 2012 at 05:37:46 EST
Thanks Sbajra,

Profile photo
Replied by Ritesh Kumar
on September 6th, 2012 at 02:30:30 EST
You can create a css class to set the lettercase of Textbox in Uppercase. The css code is as follows :
<style type="text/css">
.forUpper
{
text-transform:uppercase;
}
</style>
If you know in detail about this topic then click to following link.

http://codesolutiongallery.blogspot.in/

Profile photo
Replied by Ritesh Kumar
on September 6th, 2012 at 02:31:54 EST
You can create a css class to set the lettercase of Textbox in Uppercase. The css code is as follows :
<style type="text/css">
.forUpper
{
text-transform:uppercase;
}
</style>
If you know in detail about this topic then click to following link.

http://codesolutiongallery.blogspot.in/