Click here to Skip to main content
15,895,538 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
I need to limted the number of words a user can enter into a textbox on an asp.net webform.  I suppose that the words need to be counted as the user is entering them and then stopped when they reach the maximum word count.  Does anybody have any examples of how to do this?
Posted
Comments
VishwaKL 6-Mar-13 4:33am    
No need to use javascript/Jquery use max length property of text box that will solve your problem
april88t 6-Mar-13 20:15pm    
YOU CA HAVE AN IDEA ON THIS SITE ====>http://stackoverflow.com/questions/1384074/limit-input-box-to-0-100

1 solution

No need to use Javascript, Use MaxLength property of textbox.
Eg.
ASP.NET
<asp:textbox id="txt" runat="server" maxlength="20"></asp:textbox>


Good luck.
 
Share this answer
 
v2
Comments
Member 9155255 6-Mar-13 4:53am    
it will check for each character.....but i need to check word seperated by space
J.Karthick 6-Mar-13 5:29am    
Try spliting the content of textbox and include condition array length not exceeding 20.

In Javascript you have "Split" function. Try google it.

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