My Table in database look like as shown in image, some columns contains NULL values and i'll be showing "No Records Found" instead of NULL values in GridView.
To achieve this i've written a Method in code behind and will be calling this method in ItemTemplate of GridView.
call this server side method CheckNull written in code behind from ItemTemplate of GridView which check the NULL values and change it as we want.
C# code for the CheckNull method
protected string CheckNull(object objGrid)
{
if (object.ReferenceEquals(objGrid, DBNull.Value))
{
return "No Record Found";
}
else
{
return objGrid.ToString();
}
}
Saturday, October 2, 2010
Null value record check for gridview
Saturday, October 02, 2010 Posted by Vikas SharmaLabels: GeneralTips n Tricks
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment