2010-11-15 103 views

回答

2

默认情况下,不应检查CheckBoxList中的ListItem。如果你有Selected属性设置为true那么它会检查:

<asp:ListItem Selected="True">Item 1</asp:ListItem> 

默认情况下它是假的,这应该足够了。如果您需要清除所有需要检查的项目,则可以使用ClearSelection methodcheckboxlist.ClearSelection()

1

如果你想一套可选复选框,只需使用单个复选框,而不是一个复选框列表。

1

这不工作?

除“检查2”以外的所有内容均未选中。

<asp:CheckBoxList ID="CheckBoxList1" runat="server"> 
    <asp:ListItem Selected="False">check 1</asp:ListItem> 
    <asp:ListItem Selected="True">check 2</asp:ListItem> 
    <asp:ListItem Selected="False">check 3</asp:ListItem> 
    <asp:ListItem Selected="False">check 4</asp:ListItem> 
</asp:CheckBoxList> 
相关问题