Here is a work-around for this issue:
const int LENGTH_TEXT = 100;Click here for more detail.
protected void Page_Load(object sender, EventArgs e)
{
string
lengthFunction = "function isMaxLength(txtBox) {";
lengthFunction += " if(txtBox) { ";
lengthFunction += " return ( txtBox.value.length <=" + LENGTH_TEXT + ");";
lengthFunction += " }";
lengthFunction += "}";
this.txtMyTextBox.Attributes.Add("onkeypress", "return isMaxLength(this);");
ClientScript.RegisterClientScriptBlock(
this.GetType(),
"txtLength",
lengthFunction , true);
}
No comments:
Post a Comment