在我的应用程序中,我使用DataGrid,我绑定数据集到该DataGrid.So如果数据集记录为零,我想在我的DataGrid中显示“没有ReCORDS FOUND”。DataGrid想要显示没有记录
在此先感谢。
在我的应用程序中,我使用DataGrid,我绑定数据集到该DataGrid.So如果数据集记录为零,我想在我的DataGrid中显示“没有ReCORDS FOUND”。DataGrid想要显示没有记录
在此先感谢。
您也有GridView标签,因此对于GridView,您可以将它的EmptyDataText
属性设置为"No records found"
。这与DataGrid
有点复杂。
有一个DataGrid
没有EmptyDataText
属性,所以在你的后台代码做一些像
if (dgTest.Items.Count == 0)
{
lblEmpty.Visible = true;
lblEmpty.Text = "Empty";
}
哪里dgTest
是DataGrid
和lblEmpty
的ID是一个占位符的标签。
更好。 if(dgTest.Items.Count <1) { lblEmpty.Visible = true; lblEmpty.Text =“空”; } else { lblEmpty.Visible = false; } – Maxymus 2011-06-02 10:47:22
我们可以看到您当前的代码吗? – slandau 2011-06-01 21:09:11