function checkMaxLength( txt,e, length )
{
var mLen = txt[ " MaxLength " ];
if(null == mLen)
mLen = length;
var maxLength = parseInt ( mLen );
if(!isSpecialCharacters( e ))
{
if(txt.value.length > maxLength-1)
{
if(window.event)//for Internet Explorer
e.returnValue = false;
else// For Firefox
e.preventDefault();
}
}
}
function isSpecialCharacters(e)
{
if(e.keyCode !=8 && e.keyCode!=46 && e.keyCode!=37 && e.keyCode!=38 && e.keyCode!=39 && e.keyCode!=40)
return false;
else
return true;
}
add this in code behind file of the control
onkeyDown="checkMaxLength( this ,event ,'100' );"
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment