Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Typing in uppercase in a TextBox

Posted on 2004-09-06
6
Medium Priority
?
341 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
Industry Leaders: 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!

 
LVL 15

Accepted Solution

by:
Timbo87 earned 800 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

610 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