DataGrid想要显示NO RECORDS

时间:2011-06-01 21:07:50

标签: asp.net gridview datagrid

在我的应用程序中我正在使用DataGrid,我将数据集绑定到DataGrid.So如果数据集记录为零,我想在我的DataGrid中显示“NO ReCORDS FOUND”。

提前致谢。

2 个答案:

答案 0 :(得分:2)

EmptyDataText中没有DataGrid属性,因此在您的代码隐藏中执行类似

的操作
if (dgTest.Items.Count == 0)
{
    lblEmpty.Visible = true;
    lblEmpty.Text = "Empty";
}

其中dgTestDataGrid的ID,而lblEmpty是占位符标签。

答案 1 :(得分:0)

您也有GridView标记,因此对于GridView,您可以将其EmptyDataText属性设置为"No records found"。这有点复杂DataGrid

相关问题