Aug 19, 2009, 6:49 AM
[CLOSED] Selecting all items in a MultiSelect dynamically
Hi,
I had a Multi-Select control and I would like to make all the list items selected when first list item(All objects) is clicked
I am filling the items dynamically
The code is executing fine but the items are not getting selected.
Please let me know if I was missing something required
I had a Multi-Select control and I would like to make all the list items selected when first list item(All objects) is clicked
I am filling the items dynamically
The code is executing fine but the items are not getting selected.
Please let me know if I was missing something required
Markup
<ext:MultiSelect runat="server" MultiSelect="true" ID="msObjectTypes" Height="150" Width="150">
<AjaxEvents>
<Change OnEvent="msObjectTypes_SelectionChanged"></Change>
</AjaxEvents>
</ext:MultiSelect>
Code Behind
public void msObjectTypes_SelectionChanged(object sender, AjaxEventArgs e)
{
if (msObjectTypes.SelectedItems.Count > 0)
{
for (int selectedItemCount = 0; selectedItemCount < msObjectTypes.SelectedItems.Count; selectedItemCount++)
{
if ((int)Enums.MosaiqueObjects.AllObjects == Convert.ToInt16(msObjectTypes.SelectedItems[selectedItemCount].Value))
{
int tmpIndex=0;
foreach (Coolite.Ext.Web.ListItem list in msObjectTypes.Items)
{
msObjectTypes.SelectedItems.Add(new SelectedListItem(list.Text,list.Value,tmpIndex++));
}
break;
}
}
}
}