views:

41

answers:

1

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
I am using a datatable, do you have any sample ?
Popo
Updated my answer.
TheGeekYouNeed