for window application use
txt.CharacterCasing = CharacterCasing.Upper
and for web application use following javascript
function MakeUpper(event) {
var charCode = event.keyCode;
if (charCode >= 97 && charCode <= 122) {
event.keyCode = charCode - 32;
}
return true;
}
and on pageload write --
TextBox1.Attributes.Add("onkeypress", "MakeUpper(event)");
[Edit]
I checked this is working fine in IE but for others we need to make a small change
<pre lang="cs">function MakeUpper(evt,obj) {
var charCode = evt.which ? evt.which : evt.keyCode;
if (charCode >= 97 && charCode <= 122) {
obj.value += String.fromCharCode(charCode - 32);
evt.returnValue = false;
return false;
}
else {
return true;
}
}
and in page load--
TextBox1.Attributes.Add("onkeypress", "MakeUpper(event, this)");
[/Edit]
--Pankaj