Solved

Typing in uppercase in a TextBox

Posted on 2004-09-06
6
332 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
6 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 11989565
0
 

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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now