Solved

Typing in uppercase in a TextBox

Posted on 2004-09-06
6
334 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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 Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
System.Security 2 28
compare between entities in entity framework 8 97
Problem!!! 8 37
C# class library debugging - Breakpoint will not hit. 8 21
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

828 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