Include the below javascript method in a javascript File. function CheckLength(fn,lb,rm,mc) { var len=document.getElementById(fn).value.length; if (len > mc) { var fn1=document.getElementById(fn).value.substring(0,mc); document.getElementById(fn).value= fn1; len = mc; } else { if(fn) var rLen=mc-len; document.getElementById(lb).innerHTML=rm + rLen; } } In .aspx Page write the line to include the method from a file to page Now Suppose this method is implemented on a text box Place the two labels below the textbox string Strrm = "Remaining character: "; Now call this method on the keyup and keydown events on the textbox txtTask.Attributes.Add("onkeyup", "CheckLength('" + txtTask.ClientID + "','" + lblramaining.ClientID + "','" + Strrm + "',500);hidelabel('...