How to convert lower case to upper case
Hi everyone
How can I convert lower case to upper case when i type inside a textbox
Please provide me with vb.net code
Do you mean you want to convert it as it is being typed? Or once you receive it on the server-side?
If the latter, use the string.ToUpper() method in VB.NET.http://support.microsoft.com/kb/312897 If the former, you can use the javascript ToUppercase() method in conjunction with the onkeypress event for the textbox in question.http://jennifermadden.com/javascript/stringUpperLower.html
To achieve this on the Client side try this:
add this to your Code behind (VB.net):
ProtectedSub Page_Load(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.Load
TextBox1.Attributes.Add("onkeyup","toUppercase()")EndSub
Then in your HTML markup:
<headrunat="server">
<script>
function toUppercase() {
document.form1.TextBox1.value = document.form1.TextBox1.value.toUpperCase();
}
</script>
</head>
<body>
<formid="form1"runat="server">
<div>
<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox>
</div>
</form>
</body>
TextBox1.Text = TextBox1.Text.ToUpper
you can use style instead..
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.test
{
text-transform: uppercase;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div
</div>
<asp:TextBox ID="TextBox1" runat="server" CssClass="test"></asp:TextBox>
</form>
</body>
kaushalparik27:
you can use style instead..
.test
{
text-transform: uppercase;
}
That won't convert it. It will only change the way it appears on a web page. If you look at the source of the page where your style is used, you will see that the case of the text is still in its original state.
It works, but it saves the data with lower case in the database
have you tried this:
scott@.elbandit.co.uk:
To achieve this on the Client side try this:
add this to your Code behind (VB.net):
ProtectedSub Page_Load(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.Load
TextBox1.Attributes.Add("onkeyup","toUppercase()")EndSub
Then in your HTML markup:
<headrunat="server">
If you want to do this Server Side (VB.net):
<script>
function toUppercase() {
document.form1.TextBox1.value = document.form1.TextBox1.value.toUpperCase();
}
</script>
</head>
<body>
<formid="form1"runat="server">
<div>
<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox>
</div>
</form>
</body>TextBox1.Text = TextBox1.Text.ToUpper
pam.rose:
but it saves the data with lower case in the database
but at the time of saving in the database.. simply .ToString().ToUpper() can be used...
Labels: ado, case, convert, everyonehow, inside, net, provide, textboxplease, type, upper
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home