ASP.Net中的CheckListBox [英] CheckListBox in ASP.Net

查看:61
本文介绍了ASP.Net中的CheckListBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何遍历asp.net中的选中列表框
并设置重置其检查状态.

请帮助

how to iterate through checked list box in asp.net
and set reset its checked status.

please help

推荐答案

<asp:CheckBoxList ID="CheckBoxList1" runat="server">
            <asp:ListItem Selected="True">FirstCheckBox</asp:ListItem>
            <asp:ListItem>SecondCheckBox</asp:ListItem>
            <asp:ListItem>ThirdCheckBox</asp:ListItem>
            <asp:ListItem>FourthCheckBox</asp:ListItem>
        </asp:CheckBoxList>
        <br />
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Reset" />


protected void Button1_Click(object sender, EventArgs e)
    {
        for (int i = 0; i < CheckBoxList1.Items.Count; i++)
        {
            CheckBoxList1.Items[i].Selected = false;
        }
    }


这篇关于ASP.Net中的CheckListBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆