所以我有一个列表视图,里面有一个复选框和两个单选按钮。复选框控制单选按钮的禁用或启用位置。
正如你所看到的,我让它适用于列表中的第一项(items [0]),但我如何让它适用于列表视图中的其余行?
谢谢
System.Web.UI.WebControls.ListView lv2 = ListView1.Items[0].FindControl("ListView2") as System.Web.UI.WebControls.ListView;
CheckBox cb = lv2.Items[0].FindControl("ChargedCB") as CheckBox;
RadioButton acceptRB = lv2.Items[0].FindControl("AcceptedRB") as RadioButton;
RadioButton disputedRB = lv2.Items[0].FindControl("DisputedRB") as RadioButton;
if (cb.Checked == false)
{
acceptRB.Checked = false;
disputedRB.Checked = false;
acceptRB.Enabled = false;
disputedRB.Enabled = false;
}
else
{
acceptRB.Enabled = true;
disputedRB.Enabled = true;
}