Repeater嵌套DropDownList如何实现OnSelectedIndexChanged
Posted on 2007-06-15 12:13 wucf2004 阅读(909) 评论(0) 编辑 收藏 举报protected void selChengji_OnSelectedIndexChanged(object sender, EventArgs e)
{
DropDownList drop = sender as DropDownList; //获取当前选中的DropDownList
Repeater repS = drop.Parent.Parent as Repeater; //drop的上一级的上一级控件就是Repeater控件
int n = ((RepeaterItem)drop.Parent).ItemIndex; //获取当前选中行的索引
//获取其他信息进行操作
HtmlInputText xuefen = (HtmlInputText)(repS.Items[n].FindControl("txtXuefen"));
string id = ((HtmlInputHidden)(repS.Items[n].FindControl("txtId"))).Value;
......
}
{
DropDownList drop = sender as DropDownList; //获取当前选中的DropDownList
Repeater repS = drop.Parent.Parent as Repeater; //drop的上一级的上一级控件就是Repeater控件
int n = ((RepeaterItem)drop.Parent).ItemIndex; //获取当前选中行的索引
//获取其他信息进行操作
HtmlInputText xuefen = (HtmlInputText)(repS.Items[n].FindControl("txtXuefen"));
string id = ((HtmlInputHidden)(repS.Items[n].FindControl("txtId"))).Value;
......
}