我正在使用Asp:Grid View,我想导出一个选定记录的文件。我在网格视图中添加了复选框。我尝试了以下代码:
int k = 0;
//Checkther whether atleast one check box is selected or not
for (int i = 0; i <= GridViewExample.Rows.Count - 1; i++)
{
GridViewRow row = GridViewExample.Rows[i];
CheckBox Ckbox = (CheckBox)row.FindControl("cbkCheck");
//bool Ckbox = ((CheckBox)row.FindControl("cbkCheck")).Checked;
if (Ckbox.Checked == true)
//if (Ckbox)
{
k++;
}
}
但是,这显示为选中复选框为false。