Categories
Asp, Asp.net Javascript

Convert Text of Textbox to LowerCase and UpperCase using Javascript in Asp.Net

Convert Text of Textbox to LowerCase and UpperCase using Javascript in Asp.Net

Hi friends, in this post we will discuss Convert Text of Textbox to LowerCase and UpperCase using Javascript in Asp.Net. To accomplish this we will use Javascript.

In earlier post we had discussed about Allow Only Alphabets In Textbox Using JavaScriptAnimated Tabs With CSS3CheckBoxList Validation Using JavaScript In Asp.Net.

Code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link href="css/bootstrap.css" rel="stylesheet" />
<title>Convert Text of Textbox to LowerCase and UpperCase using Javascript in Asp.Net</title>
<script type="text/javascript">
    function ToUpper(id) {
        document.getElementById(id).value = document.getElementById(id).value.toUpperCase();
    }
    function ToLower(id) {
        document.getElementById(id).value = document.getElementById(id).value.toLowerCase();
    }
</script>

<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
</head>
<body>
<form id="form1" runat="server">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h2>Convert Text of Textbox to LowerCase and UpperCase using Javascript in Asp.Net</h2>
</div>
</div>
<div class="row">
<div class="col-lg-12>">
<hr />
</div>
</div>
<div class="row">
<div class="col-lg-4 col-lg-offset-4">
<div class="input-group">
<span class="input-group-addon" id="basic-addon1">To Lowercase: &nbsp;&nbsp;&nbsp;&nbsp;</span>
<asp:TextBox runat="server" ID="txt_date" class="form-control" onkeyup="ToLower(this.id)" placeholder="Lower Case" aria-describedby="basic-addon1"></asp:TextBox>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12>">
<hr />
</div>
</div>
<div class="row">
<div class="col-lg-4 col-lg-offset-4">
<div class="input-group">
<span class="input-group-addon" id="basic-addon1">To Uppercase: &nbsp;&nbsp;&nbsp;&nbsp;</span>
<asp:TextBox runat="server" ID="TextBox1" class="form-control" onkeyup="ToUpper(this.id)" placeholder="Upper Case" aria-describedby="basic-addon1"></asp:TextBox>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12>">
<hr />
</div>  
</div>
<div class="row">
<div class="col-lg-12" style="margin-top:30px;text-align:center">
All rights reserved by <a href="http://www.hightechnology.in">www.Hightechnology.in</a>| Back to article:
<a href="http://hightechnology.in/convert-text-of-textbox-to-lowercase-and-uppercase-using-javascript-in-asp-net/">
Convert Text of Textbox to LowerCase and UpperCase using Javascript in Asp.Net</a> | Hosting partner 
<a href="http://www.grootstech.com" target="_blank">Grootstech</a> 
</div>
</div>
</div>
</form>
</body>
</html>

Convert Text of Textbox to LowerCase and UpperCase using Javascript in Asp.Net, Convert Text in TextBox to LowerCase and UpperCase When User Typing Using Javascript