Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Fixed nunber of char in multiline text box

Fixed nunber of char in multiline text box

Scheduled Pinned Locked Moved ASP.NET
help
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    amitamit099
    wrote on last edited by
    #1

    I am using multiline text box.i set size of it 200. i set property MaxLength="200". and i am also using RangeValidator of set the fixed no of char. But it will not working ,it will accept more then 200 char. plz anyone help me.i will very thankful for him.

    B A A 3 Replies Last reply
    0
    • A amitamit099

      I am using multiline text box.i set size of it 200. i set property MaxLength="200". and i am also using RangeValidator of set the fixed no of char. But it will not working ,it will accept more then 200 char. plz anyone help me.i will very thankful for him.

      B Offline
      B Offline
      Brij
      wrote on last edited by
      #2

      please post your code . It'll be easy to answer then

      Cheers!! Brij

      1 Reply Last reply
      0
      • A amitamit099

        I am using multiline text box.i set size of it 200. i set property MaxLength="200". and i am also using RangeValidator of set the fixed no of char. But it will not working ,it will accept more then 200 char. plz anyone help me.i will very thankful for him.

        A Offline
        A Offline
        Abhijit Jana
        wrote on last edited by
        #3

        MaxLength property does not work for when you set Textmode="multiline". So, you can use ValidatorControl to Validate the range. I am not sure why this is not working for you. You can Try like this.

        Another alternative solution is to developed one custom control. I found one great article in Codeproject It self. Extending the ASP.Net Multiline TextBox control to limit the number of characters entered[^] And For your more Information Read this Post MaxLength ignored in multiline textbox.[^] Hope this will resolve your problem. Let me know if you need more help.

        Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

        1 Reply Last reply
        0
        • A amitamit099

          I am using multiline text box.i set size of it 200. i set property MaxLength="200". and i am also using RangeValidator of set the fixed no of char. But it will not working ,it will accept more then 200 char. plz anyone help me.i will very thankful for him.

          A Offline
          A Offline
          April Fans
          wrote on last edited by
          #4

          Hi, You can use JS to control it. In page: <script type="text/javascript"> function validatorTextLength(obj) { if(obj.value.length==200) { event.keyCode = 0; return ; } } </script> And in CodeFile, you need to set TextBox1.Attributes.Add("onkeypress","validatorTextLength(this)"); when pageload. Good luck.

          April Comm100 - Leading Live Chat Software Provider

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups