Asp.net ListView内的RadioButtonList未触发事件

Asp.net ListView内的RadioButtonList未触发事件,asp.net,.net,events,Asp.net,.net,Events,在ListView的SlectedIndexChanged事件中,我使用RadioButtonList(在ListView中)附加OnSelectedIndexChanged事件,当我运行程序时,单击RadioButton,即使我实现了此特定事件触发的所有代码,也不会触发事件。但是,没有语法或编译错误。告诉我调用ListView或RadioButtonList所针对的事件类型 .aspx代码: <asp:ListView ID="ListView1" runat="server" >

在ListView的SlectedIndexChanged事件中,我使用RadioButtonList(在ListView中)附加OnSelectedIndexChanged事件,当我运行程序时,单击RadioButton,即使我实现了此特定事件触发的所有代码,也不会触发事件。但是,没有语法或编译错误。告诉我调用ListView或RadioButtonList所针对的事件类型

.aspx代码:

<asp:ListView ID="ListView1" runat="server"  >
<itemtemplate>
    <asp:RadioButtonList ID="radiobuttonlist4" runat="server" AutoPostBack="true" RepeatDirection="Horizontal" Width="240px"  onselectedindexchanged="selected">
        <asp:ListItem Value="agree" ></asp:ListItem>
        <asp:ListItem Value="disagree"></asp:ListItem>
        <asp:ListItem Value="strongagree"></asp:ListItem>
        <asp:ListItem Value="strongdisagree"></asp:ListItem>
    </asp:RadioButtonList>
</itemtemplate>
</listview>

OnSelectedIndexChanged位于列表视图中,而不是单选按钮列表中。尝试将事件附件移动到单选按钮列表。

列表视图的
项数据绑定方法中,需要将
所选的
事件绑定到该列表中

var rdo = e.Row.FindControl("radiobuttonlist4") as RadioButton;
rdo.OnSelectedIndexChanged+= new EventHandler(selected);

但是我使用的是listview而不是gridview
var rdo = e.Row.FindControl("radiobuttonlist4") as RadioButton;
rdo.OnSelectedIndexChanged+= new EventHandler(selected);