Click here to Skip to main content
15,915,065 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an Textbox control in EditItemTemplate of Fprmview control.

I set Its Textmode property =Multiline
But I want restrict the user to enter more than 45 characters in textbox.
Posted

1 solution

Try like below..

In you aspx page

<textarea name="Description" id="Description"  onkeyup="CheckLength(this,'250');">Text</textarea>


in you script section

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
function CheckLength(obj,  max) {

         if (parseInt(max) > parseInt($(obj).val().length)) {
             
         }
         else {
            alert("Exceded max lentgh");
            
         }
     }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900