In the DataGrid, We can bind a dataset or able that contains an empty record to the DataGrid. In this way, the DataGrid displays the field definitions in the data source in the form of a table header.
In the gridview control, it is not displayed if dataset or able is an empty record. The table header is not displayed in the gridview.
It can only be implemented through a work und, with a little trouble:
Public void buildnorecords (gridview, dataset DS)
{
If (Ds. Tables [0]. Rows. Count = 0)
{
DS. Tables [0]. Rows. Add (Ds. Tables [0]. newrow ());
Gridview. datasource = Ds;
Gridview. databind ();
Int columncount = gridview. Rows [0]. cells. count;
Gridview. Rows [0]. cells. Clear ();
Gridview. Rows [0]. cells. Add (New tablecell ());
Gridview. Rows [0]. cells [0]. columnspan = columncount;
Gridview. Rows [0]. cells [0]. Text = "no records found .";
}
Else
{
Gridview. datasource = Ds;
Gridview. databind ();
}
}