Gautam Buddha Temple Varanasi,Varanasi - Buddhist Pilgrimage

Monday, August 9, 2010

When Gridview has no record display empty grid at runtime

When GridView(Add New Record) has no record display empty Grid at runtime.
Some time when we adding new row in gridview footer column and there is no record in database,so what we can do?
So we can disply message no record found and add new button show for adding new record.
Here is solution display runtime empty gridview.
 private void ShowNoResultFound(DataSet ds,GridView gv)
DataTable dt = (DataTable)ds.Tables[0];
gv.DataSource = dt;
int TotalColumns = gv.Rows[0].Cells.Count;
gv.Rows[0].Cells.Add(new TableCell());
gv.Rows[0].Height = 0;
gv.Rows[0].Visible = false;
Thanks & Regards
Santosh Singh

No comments:

Post a Comment