Introduction: In this I will explain how we can change the
text to Uppercase or Lowercase using JavaScript in Asp.net.
Description:
Put the below given JavaScript between Head tag of webform:
For Uppercase:
<script type="text/javascript">
function
Uppercase(id) {
var
txt = document.getElementById(id);
txt.value =
txt.value.replace(/\w\S*/g, function (txt) { return txt.charAt(0).toUpperCase() +
txt.substr(1).toLowerCase(); });
}
For Lowercase:
<script type="text/javascript">
function
Lowercase(id) {
document.getElementById(id).value =
document.getElementById(id).value.toLowerCase();
}
</script>
After that drag and drop the Textbox control from Toolbox and
onkeyup call the JavaScript function. As shown below:
<table border="1px dotted">
<tr><td><b>Uppercase
Example</b></td></tr>
<tr><td>First Name:</td><td>
<asp:TextBox ID="txtuppercase" runat="server" onkeyup="Uppercase(this.id)"></asp:TextBox></td></tr>
<tr><td><b>Lowercase
Example</b></td></tr>
<tr><td>First Name:</td><td><asp:TextBox ID="txtlowercase"
runat="server"
onkeyup="Lowercase(this.id)"></asp:TextBox></td></tr>
</table>
Now run the project and check the result.
If yes post your comment to admire my work. You can like me on Facebook, Google+, Linkedin and Twitter via hit on Follow us Button and also can get update follow by Email.
Howdy! I know this is somewhat off-topic however I had to
ReplyDeleteask. Does managing a well-established website such as yours require a
lot of work? I am brand new to operating a blog however I do write in my diary daily.
I'd like to start a blog so I can share my experience and feelings online.
Please let me know if you have any kind of recommendations or tips for new aspiring blog owners.
Thankyou!
Feel free to surf to my web-site; Fine Dining Blog (http://www.twerksessions.com/members/paulimilson/activity/11946/)
Oh my goodness! Awesome article dude! Many thanks, However I am encountering issues with your RSS.
ReplyDeleteI don't understand why I can't subscribe to it.
Is there anybody else getting similar RSS issues? Anyone that knows the solution can you
kindly respond? Thanks!!
My blog ... seo