显示在空网格GridView的页脚? [英] Show gridview footer on empty grid?

查看:130
本文介绍了显示在空网格GridView的页脚?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是想知道什么是显示数据输入的GridView的页脚,即使在GridView是空的最好和最简单的方法是什么?

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 ?

推荐答案

设置你的数据源你用充满空值的一个对象绑定到GridView对象的类型,那么隐藏的DataRow。

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.

编辑:由于您使用的DataTable ...

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();

这篇关于显示在空网格GridView的页脚?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆