FindControl
我在单元格里动态添加了RadioButtonList 控件,ID也赋值了,生成控件的代码如下:
RadioButtonList tempRadio = new RadioButtonList();
tempRadio.ID =iRoleID.ToString();
for (int j = 0; j < lstUserList.Count; j++)
{
dcModUserList = lstUserList[j];
ListItem li = new ListItem();
li.Text = dcModUserList.UserName;
li.Value = dcModUserList.UserName;
tempRadio.Items.Add(new ListItem(dcModUserList.UserName, dcModUserList.UserName));
}
tdPeopleList.Controls.Add(tempRadio);
实例RadioButtonList 的代码如下:tdPeopleList为单元格的ID
RadioButtonList tempRadio = (RadioButtonList)tdPeopleList.FindControl("sId");
结果取出来的tempRadio=null
不知道为什么