在gridview中动态添加Column并将数据绑定到它 [英] Dynamic addition of Columns in gridview and binding data to it
问题描述
亲爱的朋友,
我必须在单击按钮时将列动态添加到数据网格中.我已经完成了并将数据绑定到它的操作,但是当我尝试向它动态地向每个绑定的数据添加一个复选框列时,我无法做到这一点.
我认为当我将数据绑定到GridView时,它实际上是在将数据绑定到列而不是行中,这就是为什么我看不到任何复选框的原因.是这样还是我做错了什么??
请在这方面帮助我.
谢谢
Varun Sareen
Dear Friends,
I have to add columns to a data grid dynamically on the click of a button. That i have done and bind the data to it but when i am trying to add a checkbox column to it dynamically to each and every data bound i am not able to do that.
I think when i am binding the data to the GridView it is actually binding data to the column not in the row that''s why i am not able to see any checkbox. Is that so or it is something else i am doing wrong.?
Please help me in this regard.
Thanks
Varun Sareen
推荐答案
看一下Devakumar Sai Chinthala的代码项目文章.这说明了如何动态添加和绑定各种类型的列.
如何在GridView中创建自定义绑定字段 [如何在网格视图中动态创建模板列 [
Take a look at the codeproject article by Devakumar Sai Chinthala. This explains how to add and bind various types of columns dynamically.
How to create custom bound fields in GridView[^]
Also, you can refer following for templated columns:
How to create template columns dynamically in a grid view[^]
这篇关于在gridview中动态添加Column并将数据绑定到它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!