I would suggest using a Theme then.
1. Add a folder called app_themes in the web root (if it's not already there).
2. Add a folder called MyTheme in that folder.
3. In the MyTheme folder add a skin file (right click folder and select add>>new item. from dialog select skin).
4. In the skin file put this in:
<asp:TextBox runat='sever' MaxLength='100' />
Note that no instance variables like ID are set here.
5. In web.config set under <system.web> add <page theme='MyTheme' />
This will make all textboxes have maxlength = 100. If you want it only for a single page, don't set that in the web config. In the @Page directive at the top of the page, set theme='MyTheme'
I found this here
http://www.dotnetspider.com/forum/204101-How-set-maxlength-property-textbox-using-css.aspx[
^]