Click here to Skip to main content
15,892,643 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to find if the data source is binded to the grid or not?

If data source doesn't have the records..

It has to show message..
Can anyone can post me some code for this..?
Posted
Updated 13-Oct-12 5:44am
v3

1 solution

If your datasource does not have data then show the message based on the datatable row count.

Before binding the datasource to grid, check for rows in the datatable. If there is any row then bind it or else show the message.
Ex:
C#
// Sample snippet in C# - it was easy and quick for me to write
if(mygridsDataSourceTable.Rows.Count > 0)
{
  // BindGrid
}
else
{
  // Show message that there is no record. 
  // Show grid with Emptytextmessage
  // do whatever you like!
}
 
Share this answer
 
v2

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