日期:2014-05-17  浏览次数:20483 次

CheckBoxList选择其中一项其他自动清空
前台:
附件情况:<asp:CheckBoxList ID="CheckBoxList3" runat="server">
  </asp:CheckBoxList>
后台绑定数据(很多,这里只列举几项):
1.耳机 2.电池 3.充电器 4.无
实现:选择“无”的时候,自动清空前面已经选中的,如何实现?

------解决方案--------------------
要无刷新的改成这样:
HTML code
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:CheckBoxList ID="CheckBoxList3" runat="server" AutoPostBack="True" OnSelectedIndexChanged="CheckBoxList3_SelectedIndexChanged">
                <asp:ListItem>耳机</asp:ListItem>
                <asp:ListItem>充电器</asp:ListItem>
                <asp:ListItem>电池</asp:ListItem>
                <asp:ListItem>无</asp:ListItem>
            </asp:CheckBoxList>
        </ContentTemplate>
    </asp:UpdatePanel>
    </form>