Max length for multiline textbox in asp .net

 MaxLength property of asp:Texbox does not work if you change its Textmode to Multiline. In this post I will explain you how to resolve this issue using RegularExpression Validator and javascript.

1) Using RegularExpressionValidator. In this case we will use regular expression validator to ensure user cannot enter more than 10 charaters. You can choose value of your choice by changing 10 to your desired count in "^[\s\S]{0,10}$"

 

  
 2) By Using Javascript. In this case we will use javascript to ensure user cannot enter more than 10 characters. For this we will call javascript function on Texbox onKeyup and onChange events.
 
Javascript: 
 

    
    

 
Best quality Asp .Net Ajax Control Toolkit tutorials.
Thanks
20-Jan-2014 From  Ghan

Give your valuable comments.

Name
Email
Comment
1 + 2 =
 

About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2024 CodingFusion
50+ C# Programs for beginners to practice