Hello Experts,
I am working on Gridview , which has operations like insert , update , delete and edit operation, every operation is working fine when table data exist , and binding properly, when there is no data in the table, its not showing any thing except, no records found. but i want to insert new row through gridview for empty data source, please suggest me regarding this. if any body having sample code, please send me.
Thanks
Ram.
Loading
Abhimanyu K VatsaPosted Jun 14, 2011, 8:04 AM
More here
hope this helps
Ish BandhuPosted Jun 14, 2011, 7:31 AM
DataTable dt=new DataTable();
dt.Rows.Add(dt.NewRow);
gridview.DataSource=dt;
gridview.DataBind();
int count=gridview.columns.count;
gridview.Rows[0].Clear();
gridview.Rows[0].Cells.Add(new TableCell());
gridview.Rows[0].Cells[0].ColumnSpan = count;
gridview.Rows[0].Cells[0].Text="No Data Found."
Suthish NairPosted Jun 14, 2011, 6:56 AM
{
DataTable dt = new DataTable();
dt.Columns.Add("Name", typeof(string));
dt.Rows.Add("Test");
gv.DataSource = dt;
gv.DataBind();
dt = null;
}
Ish BandhuPosted Jun 14, 2011, 6:40 AM