Zo Has Zo Has - 6 months ago 90
ASP.NET (C#) Question

Show gridview footer on empty grid?

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 ?


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

DataRow dr = dt.NewRow();

myGridView.DataSource = dt;