Click here to Skip to main content
15,910,358 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have data grid where am adding some orders, so i have to display an alert message in the screen when there is no orders added when i login to the application. but the prob is when there are orders which is already existing in the grid when the open the app, its still display the alert message as "No orders available".

so how do i do that?

ex: if have given if(gvWorkOrderDescription.Items.Count <= 0) where "gvWorkOrderDescription" is the grid to am adding the orders.
Posted
Comments
Jackson K T 20-Feb-14 7:19am    
try gvWorkOrderDescription.Rows.Count
Member 10593922 20-Feb-14 7:35am    
there is no method to add like Row.Count

1 solution

Try this:

C#
Dataset ds=(DataSet)GridView1.DataSource;
if(ds.Tables[0].Rows.Count<=0)
{
//msg;
}

else
 {
//msg;
}
 
Share this answer
 
Comments
Member 10593922 20-Feb-14 7:35am    
in place of GridView1, il have to use gvWorkOrderDescription is it?
and when am adding like this Dataset ds = (DataSet)gvWorkOrderDescription.DataSource;
if (ds.Tables[0].Rows.Count <= 0). its throwing an error for dataset and datasource
King Fisher 20-Feb-14 7:43am    
DataSet ds = (DataSet)gvWorkOrderDescription.DataSource;
Member 10593922 20-Feb-14 7:47am    
its throwing an error when i add the above line.. please provide me some other option

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