gpt4 book ai didi

c# - 将显示所有按钮添加到正在填充的 CheckBoxList

转载 作者:太空宇宙 更新时间:2023-11-03 11:01:37 24 4
gpt4 key购买 nike

假设我有下表:

enter image description here

和以下 CheckBoxList:

<asp:CheckBoxList runat="server" ID="MyCheckBoxList"/>

在代码隐藏中,我按如下方式填充它:

MyCheckBoxList.DataSource = from c in EMPLOYEE
select c.NAME;

然后我将得到以下结果:

enter image description here

现在,我该怎么做才能得到以下结果:

enter image description here

我不想碰 table 来实现这个。我试过 MyCheckBoxList.Items.Add("Show All"); 然后填充列表无济于事。我也试过最后添加它,但它会在底部而不是顶部。

最佳答案

设置AppendDataBoundItemstrue 并将此项目添加为静态 ListItem:

<asp:CheckBoxList ID="MyCheckBoxList" runat="server" AppendDataBoundItems="true">
<asp:ListItem Selected="true">Show All</asp:ListItem>
</asp:CheckBoxList>

关于c# - 将显示所有按钮添加到正在填充的 CheckBoxList,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17495799/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com