在我的應用程序中,我使用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