Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8188681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:59:54+00:00 2026-06-07T02:59:54+00:00

My asp .net web application requires a telerik:RadTextBox that can accept 160 characters max.

  • 0

My asp .net web application requires a telerik:RadTextBox that can accept 160 characters max. Every time a character is entered into this textbox, I want the number of remaining characters that i can type to be displayed near this textbox as a label.Can anyone tell me which event should i make use of and provide javascript code to implement this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T02:59:56+00:00Added an answer on June 7, 2026 at 2:59 am

    I have done something similar to this with a series of user controls that have text boxes in them. I would recommend using the onkey up and onkey down events to increase/lower your counter.

    This is the javascript that we use.

    <script type="text/javascript" language="Javascript">
        //Character count script!
        function textCounter(field, countfield, maxlimit) {
            if (countfield == null) { return; }
    
            if (field.value.length > maxlimit)
                field.value = field.value.substring(0, maxlimit) + " Characters Remaining";
            else
                countfield.value = maxlimit - field.value.length + " Characters Remaining";
        }
    </script>
    

    Here is something similar to the text box with the counter field below it.

       <telerik:RadTextBox ID="txtTextBox" runat="server"  />
        <input readonly="readonly" enableviewstate ="false" type="text" runat="server" id="charCount" size="25" name="charCount" tabindex="-1" value="" 
            style="border: solid 0px white; display:none; background: white; font-size: 11px; color: #FF0000; text-align: right; float:right" />
    

    The attributes are added onLoad if there is a maxlength for the textbox.

            txtTextBox.Attributes.Item("onblur") = charCount.ClientID + ".style.display='none';"
            txtTextBox.Attributes.Item("onfocus") = charCount.ClientID + ".style.display='block';"
            txtTextBox.Attributes.Item("onkeyup") = "textCounter(this, " + charCount.ClientID + "," + myMaxLength.ToString + ");"
            txtTextBox.Attributes.Item("onkeydown") = "textCounter(this, " + charCount.ClientID + "," + myMaxLength.ToString + ");"
    

    When all this is combined it will shoe up the counter if you have set a max limit on it, only when that text box has focus. Once the focus is gone the script onblur hides the text box again. The counter is fired on the onkeyup and onkeydown so the count will stay accurate. It will count backwards to 0 and once it reaches 0 the user will not be able to enter more text.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET web application that requires users to select their appropriate time
I have an ASP.NET application that requires impersonation as an administrator user. In web.config:
I have an ASP.NET web forms application that requires that requires that a user
I have an asp.net MVC web application that requires tasks to be scheduled. (A
I have a asp.net web application that uses C#. It logs in on a
I've got an ASP.NET web application, that is essentially our intranet site. I made
So I have this asp.net web application that I renamed. I changed the assembly
I have an ASP.NET MVC web application that implements a custom membership provider. The
I have some javascript that requires a specific URL to call an ASP.NET web
Can anyone explain why the following happens: My ASP.NET application requires access to Application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.