Pete2003
asked on
Typing in uppercase in a TextBox
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
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
ASKER
Sorry wasn't specific enough .. I meant for WEB forms .. not windows forms ...
Txs
Peter
Txs
Peter
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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(se lObj).valu e = document.getElementById(se lObj).valu e.toUpperC ase();
}
</script>
<asp:textbox id="txtTest" runat="server"/>
txtTest.Attributes.Add("on KeyPress", "convertUp perCase('t xtTest')") 'code-behi nd
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(se
}
</script>
<asp:textbox id="txtTest" runat="server"/>
txtTest.Attributes.Add("on
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformstextboxclasscharactercasingtopic.asp
TextBox.CharacterCasing Property