如何自定义网格视图列? [英] How to Customize the grid view columns?

查看:68
本文介绍了如何自定义网格视图列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1 用户选择网格查看 所需的订单
2 )基于 user 选择列应反映 网格视图
对于示例,网格视图 包含两列喜欢 员工姓名 ID 名称
如果 用户选择中的列 序列 喜欢 < span class =code-string> ID as first column 名称 第二个 员工将 命名为第三个然后应该反映 grid view contains 模板字段)。

解决方案

其中一个解决方案是根据所选列创建动态选择查询。



如果没有,那么你可以像这样动态生成绑定列。 />




 BoundField bd = new BoundField(); 
bd.DataField =ProductID;

bd.HeaderText =ProductID;
grdView.Columns.Add(bd);





动态添加模板列如下链接

http://forums.asp.net/t/1001702.aspx [ ^ ]


1)User selects the grid view columns in the required order.
2)based on the user selection the columns should be reflected in the grid view.
For example, the grid view contains two columns like "Employee Name", "ID", and "Designation".
If user selects the columns in the sequence like, "ID" as first column, "Designation" as second column and "Employee Name" as third column, then same should be reflected in grid view(contains template fields).

解决方案

One of the solution is to create dynamic select query based on column selected.

If not then you can generate bound column dynamically like this.


BoundField bd = new BoundField();
bd.DataField = "ProductID";

bd.HeaderText = "ProductID";
grdView.Columns.Add(bd);



for dynamically adding template column follow below link
http://forums.asp.net/t/1001702.aspx[^]


这篇关于如何自定义网格视图列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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