C# textbox.Attributes.Add("onkeyup", "javascript:return getDate(event);");
JavaScript
JavaScript
function getDate(elem){
var elemVal = elem.value;
var elemId = elem.id;
switch(elemVal.length){
case 2:
elemVal = elemVal+"/";
break;
case 5:
elemVal = elemVal+"/";
break;
}
document.getElementById(elemId).value = elemVal;
}
var elemVal = elem.value;
var elemId = elem.id;
switch(elemVal.length){
case 2:
elemVal = elemVal+"/";
break;
case 5:
elemVal = elemVal+"/";
break;
}
document.getElementById(elemId).value = elemVal;
}