on .aspx page
<script language="javascript" type="text/javascript"7gt;
function check_float(e,field)
{
if (!(((e.keyCode>=48)&&(e.keyCode<=57))(e.keyCode==46)))
{
alert("Only Digits Are Allowed!");
e.keyCode=0;
}
if (e.keyCode==46)
{
var patt1=new RegExp("\\.");
var ch =patt1.exec(field);
if(ch==".")
{
alert("More then one decimal point not allowed");
e.keyCode=0; }
}
}
</script>
on code behind (.aspx.cs page) :
TextBox5.Attributes.Add("onkeypress", "check_float(event,document.getElementById('" + TextBox5.ClientID + "').value)");
TextBox6.Attributes.Add("onkeypress", "check_float(event,document.getElementById('" + TextBox6.ClientID + "').value)");
Thanks and Regards
Varun Bansal
Assistant Programmer
NIC, Jaipur
<script language="javascript" type="text/javascript"7gt;
function check_float(e,field)
{
if (!(((e.keyCode>=48)&&(e.keyCode<=57))(e.keyCode==46)))
{
alert("Only Digits Are Allowed!");
e.keyCode=0;
}
if (e.keyCode==46)
{
var patt1=new RegExp("\\.");
var ch =patt1.exec(field);
if(ch==".")
{
alert("More then one decimal point not allowed");
e.keyCode=0; }
}
}
</script>
on code behind (.aspx.cs page) :
TextBox5.Attributes.Add("onkeypress", "check_float(event,document.getElementById('" + TextBox5.ClientID + "').value)");
TextBox6.Attributes.Add("onkeypress", "check_float(event,document.getElementById('" + TextBox6.ClientID + "').value)");
Thanks and Regards
Varun Bansal
Assistant Programmer
NIC, Jaipur
No comments:
Post a Comment