In C#:
<asp:textbox id="txtComments" runat="server" bordercolor="Gray" xmlns:asp="#unknown">
BorderStyle="Solid" BorderWidth="1px" CausesValidation="true" Wrap="true"
MaxLength="100"
TextMode="MultiLine"
Width="350px"></asp:textbox>
in aspx.cs
public int MaxLength
{
get { return txtComments.MaxLength; }
set { txtComments.MaxLength = value; }
}
public void wordCount()
{
txtCount.Text = txtComments.MaxLength.ToString();
txtComments.Attributes.Add("onKeyUp", "javascript:document.getElementById('" + txtCount.ClientID + "').setAttribute('value', (" + txtComments.MaxLength + " - parseInt(document.getElementById('" + txtComments.ClientID + "').getAttribute('value').length)));");
}