MEL depends on xListbox controls to enable adding and removing items dynamically from a listbox. It's bundled in the release. Simply add the two components to your project and the AJAX Control Toolkit if you have not already. Then drag the controls onto your ASP.NET page. Get two buttons or image controls to move items. Then configure the extender to use those controls. Here's a bit of sample code:

<cc1:xListBox ID="XListBoxA" runat="server"  SelectionMode="Multiple">
	<asp:ListItem Text="A" Value="a"></asp:ListItem>
	<asp:ListItem Text="B" Value="b"></asp:ListItem>
	<asp:ListItem Text="C" Value="c"></asp:ListItem>
	<asp:ListItem Text="D" Value="d"></asp:ListItem>
</cc1:xListBox>

<cc1:xListBox ID="XListBoxB" runat="server" SelectionMode="Multiple"></cc1:xListBox>

<asp:Button ID="btnRight" runat="server" Text="Add ->" />
<asp:Button ID="btnLeft" runat="server" Text="<- Remove" />

<cc2:MutuallyExclusiveListboxesExtender ID="MutuallyExclusiveListboxesExtender1" TargetControlID="XListBoxA" 
	ButtonLeft="btnLeft" ButtonRight="btnRight" ListboxB="XListBoxB" runat="server">
</cc2:MutuallyExclusiveListboxesExtender>


The Mutually Exclusive Listboxes Extender has a few options:
  • TargetControlID xListBox Control ID representing the leftmost listbox control
  • ListboxB xListBox Control ID representing the right listbox control
  • ButtonLeft Control ID of control that will move items from the right listbox to the left listbox
  • ButtonRight Control ID of control that will move items from the left listbox to the right listbox

Last edited Jan 26, 2008 at 4:16 AM by kdeenanauth, version 2

Comments

No comments yet.