Hello guys, just wanted to know what is the best and easiest way to show a gridview footer for data entry even when the gridview is empty ?
+1
A:
Set your datasource to the type of object you're binding to the GridView with one object filled with empty values, then hide that DataRow.
EDIT: Since you're using a datatable...
DataTable dt = new DataTable();
// Define all of the columns you are binding in your GridView
dt.Columns.Add("AColumnName");
...
...
DataRow dr = dt.NewRow();
dt.Rows.Add(dr);
myGridView.DataSource = dt;
myGridView.DataBind();
TheGeekYouNeed
2010-08-09 05:42:03
I am using a datatable, do you have any sample ?
Popo
2010-08-09 06:04:35
Updated my answer.
TheGeekYouNeed
2010-08-09 07:36:14