如何读取绑定到具有自动生成列的 Gridview 的布尔值

问题描述 投票:0回答:1
c# asp.net gridview autogeneratecolumn
1个回答
0
投票

在 GridView 中为布尔列呈现时,复选框将成为 cells[] 集合的子控件。

所以,你需要

((CheckBox)row.Cells[2].Controls[0]).Checked

上面返回一个布尔值。因此,您可以添加到上面:

((CheckBox)row.Cells[2].Controls[0]).Checked.ToString()
© www.soinside.com 2019 - 2024. All rights reserved.