Saturday, January 5, 2019

3 Easiest Way to Change text in Uppercase in ASP.net

 3 Easiest way to Change text in Uppercase in ASP.net

In this post we are going to learn 3 easiest way to change Text  in uppercase in ASP.Net web Application by SKOTechLearn. Here, when a user wants to input some string or character into Textbox, it automatically getting in capital letter or upper case. When you press character key from Keyboard it must be converted in capital letter format.
Text with normal and upper case in asp.net
Text with normal and upper case
So here, we will normally learn all given question of this related topic.
  • How can we convert lower case textbox to upper case?
  • How to type character in uppercase in ASP.net?
  • How to convert all text to Uppercase in Textbox?
Further for this process activity, SKOTechLearn will explain all types of short and long process to solve these questions of typing conversion.

There are following process to convert or change text in Uppercase:
  1. Simple way to define style code on Particular Textbox
  2. Write javascript for more than one Textbox during keypress
  3. Write a CSS code for Uppercase
 1. Simple way to define style code on Particular Textbox:
For this process choose particular textbox and go to source screen of your WebForm application.
Write some HTML style code of particular control’s just mention as following.

Current Code:
<asp:TextBox ID="CustSr_Txt" runat="server" Width="151px"></asp:TextBox>

Style code:
style="text-transform:uppercase;"

Now insert this code like
<asp:TextBox ID="CustSr_Txt" runat="server" Width="151px" style="text-transform:uppercase;"></asp:TextBox>
text_transform_style_code
text-transform style code
You can write this particular code in more than one Text control.

 2. Write javascript for Textbox during keypress:
For this process, first you have to write javascript function on HTML source code such as following describe:

<script language=javascript>

    function UcaseTxt(UpCstr) {
        var UCStr = UpCstr.value;
        UpCstr.value = UCStr.toUpperCase();
    }
</script>
You can describe it just bellow of  <body> . Just copy this code and paste there.

Now, after that call this function on your particular Text control. For calling it, take a look of following html code.

Call script code:
<asp:TextBox ID="CustSr_Txt" runat="server" Width="151px" onkeyup="UcaseTxt(this)"></asp:TextBox>
sanjeev
Calling Javascript Function in controls
Calling Javascript Function
Now after this, run application and find that your requirement has been fulfill.

 3. Write a CSS code for Uppercase :
For this process, you can add style sheet on your project or you can define style on your particular web application.

Suppose we will well define style code on webform. For this, find <Head> tag and just bellow of it, write style code same as I mention bellow:

<style type="text/css">

        .utxt
        {
            text-transform:uppercase ;
         }
</style>
Call this CSS script on particular control like give instruction.
<asp:TextBox ID="CustSr_Txt" runat="server" Width="151px" CssClass="utxt"></asp:TextBox>

There is two process of define CssClass, First is through directly input on particular control in “Source” screen. And the second one is select CssClass through “Properties” window.
Define CssClass through Proerties
Define CssClass through Proerties
You well known, where this CSS script will place. But if you don’t know about it, follow the following image.
Style code inside HTML code
Style code inside HTML code
After that, if we choose any one of these process for existing requirement, every process will represent same output as show in following figure.
Uppercase Text value output in asp.net
So friends, these are the process for Uppercase or Capital letter text into Textbox which SKOTechlearn has explained with step by step process.

Now, you can easily put it on your application by learning Uppercase Textbox value in ASP.Net.

0 comments: