Click here to Skip to main content
15,909,193 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello

i have a datagridview contain editable textboxes

now i want to validate selected cell on key press event so that a cell will accept only integer values in c#.net 3.5

i have to do validation on key press event because cell accepts only integer values
Posted
Updated 16-Mar-10 21:25pm
v2

//U can do via javascript as

C#
function OnlyInteger(txt)
{
  var selectedCell=txt.value;
  if(isNaN(selectedCell))
  alert(selectedCell+"-->Not a Number; Pls enter the value in numeric");
  if(selectedCell=="")
  alert(selectedCell+"--->value can't be empty");
}


//On your editabel textBox, jus call the above function as
ASP.NET
<input type="text" id="textBox1"  runat="server"  önclick="OnlyInteger(this)"/>

//hope u can get some way out
 
Share this answer
 
v2
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900