2010-02-06 65 views
1

如何在列表框內添加複選框。 ChechBoxList控件不適用於更多記錄,通過使用listbox用戶可以輕鬆滾動選擇該項目。列表框內的複選框

Geetha。

回答

2

checkedListBox

<asp:CheckBoxList id="checkboxlist1" runat="server"> 
     <asp:ListItem>Item 1</asp:ListItem> 
     <asp:ListItem>Item 2</asp:ListItem> 
     <asp:ListItem>Item 3</asp:ListItem>   
</asp:CheckBoxList> 

要訪問用戶的行動項目

void checkboxlist1_Clicked(Object sender, EventArgs e) 
{   
    if (checkBoxList1.SelectedIndex == 1) 
    { 
     // DoSomething 
    }  
} 
+0

這是CheckBoxList,而不是checkedListBox。 – 2010-02-06 08:12:36

-1
<ListBox x:Name="targetList" ItemsSource="{Binding}"> 

<ListBox.ItemTemplate> 

<HierarchicalDataTemplate> 

<StackPanel Orientation="Horizontal"> 

<CheckBox> 

<TextBlock Text="{Binding Path=Name}"/> 

</CheckBox> 

</StackPanel> 

</HierarchicalDataTemplate> 

</ListBox.ItemTemplate> 

</ListBox> 
+0

原始海報(OP)詢問ASP.NET解決方案 - 請閱讀該問題。 – 2010-02-06 07:30:21