【发布时间】:2011-09-06 15:42:24
【问题描述】:
在我的应用程序中,我正在使用 DataGrid,我将数据集绑定到该 DataGrid。因此,如果数据集记录为零,我想在我的 DataGrid 中显示“NO ReCORDS FOUND”。
提前致谢。
【问题讨论】:
-
我们可以查看您当前的代码吗?
在我的应用程序中,我正在使用 DataGrid,我将数据集绑定到该 DataGrid。因此,如果数据集记录为零,我想在我的 DataGrid 中显示“NO ReCORDS FOUND”。
提前致谢。
【问题讨论】:
DataGrid 中没有 EmptyDataText 属性,因此在您的代码隐藏中执行类似的操作
if (dgTest.Items.Count == 0)
{
lblEmpty.Visible = true;
lblEmpty.Text = "Empty";
}
其中dgTest 是DataGrid 的ID,lblEmpty 是占位符标签。
【讨论】:
您也有 GridView 标签,因此对于 GridView,您可以将其 EmptyDataText 属性设置为 "No records found" 。 DataGrid 有点复杂。
【讨论】: