如何在C#中检查数据网格中的计数 [英] How To Check The Count In Data Grid I C#

查看:53
本文介绍了如何在C#中检查数据网格中的计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有要添加一些订单的数据网格,因此当我登录该应用程序时,如果没有添加任何订单,则必须在屏幕上显示警报消息.但是问题在于打开应用程序时,网格中已经有订单,它仍然显示警告消息为无可用订单".

那我该怎么办呢?

例如:如果给定了if(gvWorkOrderDescription.Items.Count< = 0),其中"gvWorkOrderDescription"是要添加订单的网格.

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.

推荐答案

尝试以下操作:

Try this:

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

else
 {
//msg;
}


这篇关于如何在C#中检查数据网格中的计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆