ASP.NET RadioButton列表取消选择

ASP.NET RadioButton列表取消选择,asp.net,radiobuttonlist,Asp.net,Radiobuttonlist,我有一个无线电按钮列表: <asp:RadioButtonList ID="rblSwitch1" runat="server" onselectedindexchanged="rblSwitch1_SelectedIndexChanged" style="margin-left: 0px" AutoPostBack="True"> <asp:List

我有一个无线电按钮列表:

  <asp:RadioButtonList ID="rblSwitch1" runat="server" 
                    onselectedindexchanged="rblSwitch1_SelectedIndexChanged" 
                    style="margin-left: 0px" AutoPostBack="True">
                    <asp:ListItem Value="0">New Shipment</asp:ListItem>
                    <asp:ListItem Value="1">Existing Shipment</asp:ListItem>
                </asp:RadioButtonList>

检查“rblSwitch1\u SelectedIndexChanged”方法,确保它没有重新定向回此页面,或以其他方式设置rblSwitch1的SelectedValue。

是否在回发时保留所选值?@BillyCoover我不确定你的意思,我认为这意味着我没有。它应该自动保留在ViewState中。还有其他代码会弄乱单选按钮吗?“AutoPostBack=”True”“--是的,他会在回发中保留它。您的标记没有问题。您需要提供完整的代码和更多的标记,以便能够看到可能发生的情况。根据他的评论“偶尔一天5次”,我怀疑这不是一个直接的回复。可能是会话状态问题,或者他有一些基于时间的条件,正在执行重新定向或更改选定的值。
    protected void rblSwitch1_SelectedIndexChanged(object sender, EventArgs e)
    {




    }