I have a GridView which is editable and is bound to a database. So the datatype of each column in the GridView is Int in the database. Therefore my GridView accepts only integer.
But I want to give a notification to the user if the user enters any other character in the GridView cells other than numbers.
Basically I need to validate and give a error message.
Can someone help me how to go about it?
I have used Boundfields for my GridView.
Therefore suppose I enter any character other than a number it gives me an exception message saying : System.Data.SqlClient.SqlException: Conversion failed when converting the nvarchar value ‘a’ to data type int.
You best bet is to convert the
BoundFieldinto aTemplateFieldand add the validation control to theEditItemTemplate.SOURCE