Hi All,

I have bounded a grid with some data. Now i need to show a text "No items bounded" when the grid doesn't have any rows to bind in it. I have tried this coding....

in VS 2005 grid_RowDataBound

if (grid.Rows.Count == 0)


lblStatus.Text = "No items found";


But this is not working.... Can anyone help me



Re: Windows Forms Data Controls and Databinding How to show a default text when no rows is bounded in a grid?

Zhi-Xin Ye - MSFT


By default, when you bind a DataGridView to a dataset like or datatable like datasource, and allow user to add new row, the row counting of the DataGridView would contain a "New Row", so when no items bound, the count is 1 instead of 0. You can count the rows in the datasource instead of the DataGridView.