Maxlength Attribute Doesn't Display When Html Is Rendered?
This property is applicable only when the TextMode property is set to TextBoxMode.SingleLine or TextBoxMode.Password.
Lowercase maxlength
attribute works on <textarea>
but not all browsers supports it so it may depends on that or how ASP.NET will handle that property (it doesn't support it so it may simply remove that attribute).
Edit: You can workaround this limitation using some JavaScript or a validation control with this expression: ValidationExpression="^[\s\S]{0,500}$"
(code from here). If you want to perform only client-side validation then you have at least these options:
1) Use a different name for that attribute (like data-maxlength
) both in your ASP.NET page and in your JavaScript:
<asp:TextBoxrunat="server"ID="txtFinBillingTerms"data-maxlength="500"ToolTip="(e.g. 90/10, 30/30/30/10, etc.)"TextMode="MultiLine"Columns="5"Rows="5"Width="300px"></asp:TextBox>
With:
var maxLength = $(this).data('maxlength');
2) If you don't use directly your <asp:Input>
control in your ASP.NET code then you may use a <textarea runat="server">
instead of official ASP.NET control, like this example:
<textarearunat="server"ID="txtFinBillingTerms"maxlength="500"title="(e.g. 90/10, 30/30/30/10, etc.)"cols="5"rows="5"style="width: 300px"></textarea>
Post a Comment for "Maxlength Attribute Doesn't Display When Html Is Rendered?"