Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting a TextBox to have a maximum length

Status
Not open for further replies.

kezzab

Programmer
Nov 9, 2005
14
GB
I have an application with a simple form which populates a backend SQL database. At the moment I can enter as much information as i like but if I go over the database field limit it gets truncated.

Is there a way I can specify the number of characters allowed at the data entry satge.

A snippet of my current code is as follows:-

<tr><td class='tdRowLabel'>Initials:</td> <td>
<asp:TextBox ID="txtInitials" Text='<%#Eval("Initials") %>' Size = "5" runat="server" />
</td></tr>

Thanks in Advance
 
In classic ASP...

Code:
<tr><td class='tdRowLabel'>Initials:</td>               <td>
  <asp:TextBox ID="txtInitials" Text='<%#Eval("Initials") %>' Size = "5" [!]maxlength="20"[/!] runat="server" />
</td></tr>

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Thank you - i got tied up with a MaxTextLength property for some reason!

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top