Friday, 28 September 2012

How to restrict textbox to enter 500 characters only after that if we insert any character it will display pop up message

Design page
<asp:TextBox ID="txtreqtitle" runat="server" CssClass="textCopy" Width="260px" Columns="25"
 MaxLength="500" TextMode="MultiLine"  Rows="3" Height="55px"  ></asp:TextBox>

aspx.cs page
this.txtreqtitle.Attributes.Add("onKeyPress", "return textCounter(this, 500);");
this.txtreqtitle.Attributes.Add("onKeyUp", "return textCounter(this, 500);");

No comments:

Post a Comment