Repeater中嵌入了RadioButtonList,我想在选择不同选项时触发RadioButtonList的OnSelectedIndexChanged事件OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged"
如果没有使用嵌套的话直接在RadioButtonList的RadioButtonList1_SelectedIndexChanged里写代码就行了,但使用嵌套了那应该在什么事件中写代码?

解决方案 »

  1.   

    还是在RadioButtonList1_SelectedIndexChanged中    RadioButtonList中加入参数判断即可
      

  2.   

    protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        RadioButtonList r = sender as RadioButtonList;
        Response.Write(r.SelectedIndex);
    }
      

  3.   

    嵌套和这个RPT有什么关系。不理解
      

  4.   

    定义它的CommandName属性,在Repeater的OnItemCommand="Repeater1_ItemCommand"事件中执行你想袖的功能
      

  5.   

    参考相关,看看这个事件是怎样写,明白了,也会写你的RadioButtonList的OnSelectedIndexChanged事件了,重点部分,就是OnItemCreated事件。http://www.cnblogs.com/insus/articles/1419980.html
    http://www.cnblogs.com/insus/articles/2036884.html
      

  6.   

    你还在这事件里写不行啊或者就是ITEMCommand啊
      

  7.   

    以前写事件可能是双击或者在事件栏双击,其实在.cs页面直接写事件也是一样的。不过需要你手动添加事件,
    <asp:RadioButtonList ID="RadioButtonList1" runat="server" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged"> 是可以触发的