I use onkeypress="return this.value.length" that working fine. but i do copy and paste it keep on putting data in the text box. it should work for copy-paste operation too.
what i need to do for copy-paste operation to work for that too!
If you are looking for a way to limit what characters can be entered into a text box, you may find that the AjaxControlToolKit can help. It has a control called Filtered Textbox contro. Take a look at http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/FilteredTextBox/FilteredTextBox.aspx