如何添加复选框列的GridView [英] how to add checkbox column to gridview
本文介绍了如何添加复选框列的GridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何复选框列添加到GridView控件。
How to add checkbox column to gridview .
我试过:
foreach (GridViewRow objRow in GridView1.Rows)
{
TableCell tcCheckCell = new TableCell();
CheckBox chkCheckBox = new CheckBox();
tcCheckCell.Controls.Add(chkCheckBox);
objRow.Cells.Add( tcCheckCell);
}
我如何添加的objRow
来GridView的?还是有添加复选框列到ASP.net GridView控件
?
How can i add the objrow
to gridview? Or is there any other method of adding a checkbox column to an ASP.net GridView
?
推荐答案
的问题是,你不能一个的 复选框
字段的添加到 GridView控件
为了有一个复选框列 - 在GridView不支持它:
The problem is that you cannot add a CheckBox
field to a GridView
in order to have a column of checkboxes - the GridView doesn't support it:
相反,你必须修改 模板的每一行,手动添加的 复选框
控制的某一行的模板。
Instead you have to change the template of each row, manually adding a CheckBox
control to the template of a row.
- 我不能告诉你怎么做
- 我不能告诉你如何看哪些项目用户已经检查
- 我不能告诉你如何默认他们中的一些检查
但它是你必须做的事情。
But it's what you have to do.
这篇关于如何添加复选框列的GridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文