我是一个非常菜鸟,这是我的第一篇文章,所以当我选中一个复选框并且它仅适用于一行时,需要您的帮助来尝试禁用列表视图中的所有单选按钮控件。
这是我的代码:
protected void chkb_DG_NO_CheckedChanged(object sender, EventArgs e)
{
foreach (ListViewItem item in ListView1.Items)
{
RadioButton RD1 = (RadioButton)ListView1.Items[0].FindControl("R1");
RadioButton RD2 = (RadioButton)ListView1.Items[0].FindControl("R2");
RadioButton RD3 = (RadioButton)ListView1.Items[0].FindControl("R3");
RadioButton RD4 = (RadioButton)ListView1.Items[0].FindControl("R4");
RadioButton LD1 = (RadioButton)ListView1.Items[0].FindControl("L1");
RadioButton LD2 = (RadioButton)ListView1.Items[0].FindControl("L2");
RadioButton LD3 = (RadioButton)ListView1.Items[0].FindControl("L3");
RadioButton LD4 = (RadioButton)ListView1.Items[0].FindControl("L4");
RD1.Enabled = false;
RD2.Enabled = false;
RD3.Enabled = false;
RD4.Enabled = false;
LD1.Enabled = false;
LD2.Enabled = false;
LD3.Enabled = false;
LD4.Enabled = false;
}
}
我应该改变什么?