Solved

Typing in uppercase in a TextBox

Posted on 2004-09-06
6
339 Views
Last Modified: 2012-06-22
Hi All,

I remember that in C++ (MFC) you could specify whether the text box is a password and if you want to use uppercase/lowercase or as typed.

I see now you can still specify the password part but there is no way of changing what is being typed to uppercase ...

Is this true or am I missing something ... if not is the only way of fixing this by using an onchange event ?

Txs
Peter
0
Comment
Question by:Pete2003
[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
6 Comments
 

Author Comment

by:Pete2003
ID: 11989905
Sorry wasn't specific enough .. I meant for WEB forms .. not windows forms ...

Txs
Peter
0
 
LVL 20

Expert Comment

by:TheAvenger
ID: 11990082
You cannot change this for Web forms. This is not part of .Net or C# but from the HTML standards and you cannot change it :-(( You can however write some JavaScript that changes the text to upper when the user enters something in your text box
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 15

Accepted Solution

by:
Timbo87 earned 200 total points
ID: 11990379
If you're using ASP.NET server controls, try this:

textBox1.Attributes.Add("onkeyup", "this.value = this.value.toUpperCase();");

You'll want to perform a server side check when they post the data though, in case the user has JavaScript disabled.
0
 
LVL 29

Expert Comment

by:David H.H.Lee
ID: 11990957
Pete2003,
Try this instead (use some delay to convert the typed text into uppercase):
function convertUpperCase(keyItem)  {
     setTimeout('ConvertKey("' +keyItem+ '")', 1);
}
function ConvertKey(selObj)  {
     document.getElementById(selObj).value = document.getElementById(selObj).value.toUpperCase();
}
</script>
<asp:textbox id="txtTest" runat="server"/>

txtTest.Attributes.Add("onKeyPress","convertUpperCase('txtTest')")'code-behind
0
 
LVL 18

Expert Comment

by:armoghan
ID: 11993690
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

688 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