In this tutorial, we will learn about checkboxlist, and listbox, and how to move the selected data in checkboxlist to the Listbox. Here, we are not taking dynamic data to the checkbox but we are creating a list item in the checkboxlist and working around that.
INITIAL CHAMBER
Step 1
Open your Visual Studio 2010 and create an Empty Website. Give a suitable name [checkboxlist_demo].
Step 2
In Solution Explorer, you get your empty website. Add a web form like this –
For Web Form
checkboxlist _demo (Your Empty Website) -> Right click -> Add New Item -> Web Form. Name it as -> checkboxlist _demo.aspx.
DESIGN CHAMBER
Step 3
Now Open your checkboxlist _demo.aspx file, where we create our design for our simple demo, we take checkboxlist, ListBox and a Label from the toolbox. Here in the Checkboxlist add ListItem by clicking on the smart tag. You can add any data to listitem, for the simple convenience we had taken favorites sports data.
The approach is very simple, when you select any checkbox, it will transfer that selected data to the listbox, it will also show in the label according to count measure we put in the checkboxlist.
checkboxlist _demo.aspx 
- <tr>
- <td class="auto-style1">
- <asp:CheckBoxList ID="CheckBoxList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="CheckBoxList1_SelectedIndexChanged">
- <asp:ListItem>Cricket</asp:ListItem>
- <asp:ListItem>Football</asp:ListItem>
- <asp:ListItem>Volleyball</asp:ListItem>
- <asp:ListItem>Basketball</asp:ListItem>
- <asp:ListItem>Hockey</asp:ListItem>
- </asp:CheckBoxList>
- </td>
- <td>
- <asp:ListBox ID="ListBox1" runat="server" Height="126px" SelectionMode="Multiple" Width="131px"></asp:ListBox>
- </td>
- <td> </td>
- </tr>


Join the conversation! Your thoughts help the community grow.