FindControl

mqfwjp 2009-03-25 12:30:47
我在单元格里动态添加了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
不知道为什么

...全文
48 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
typeof 2009-03-25
  • 打赏
  • 举报
回复
up

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧