Easy solution for restricting text to MAXLENGTH in a multiline textbox, using Ajax MaskedEdit extender.
To get the effect of Maxlength=50, just attach the MaskedEdit extender to the multiline textbox and set the Mask value to ?{50}.
Following example shows a 'Maxlength' of 300.
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Remarks") %>' Width="700px" TextMode="MultiLine"></asp:TextBox>
<cc1:MaskedEditExtender ID="MaskedEditExtender1" runat="server" Mask="?{300}" PromptCharacter="" TargetControlID="TextBox1">
</cc1:MaskedEditExtender>
.NET tips
Tuesday, July 21, 2009
Subscribe to:
Posts (Atom)