This is common funcationality that we want mostly when developing web sites. First list box will show all the available items and second list box will show only selected items by user.
User may wants to move items
one by one or
multiple selected items may want to move second list box or
all the items want to move second list list box.
protected void groupSetRight_Click(object sender, ImageClickEventArgs e)
{
for (int i = 0; i < AvailableGroupListBox.Items.Count; i++)
{
if (AvailableGroupListBox.Items[i].Selected == true)
{
myGroupListBox.Items.Add(AvailableGroupListBox.Items[i]);
AvailableGroupListBox.Items[i].Selected = false;
AvailableGroupListBox.Items.Remove(AvailableGroupListBox.Items[i]);
i--;
}
}
}
protected void allGroupSetRight_Click(object sender, ImageClickEventArgs e)
{
for (int i = 0; i < AvailableGroupListBox.Items.Count; i++)
{
myGroupListBox.Items.Add(AvailableGroupListBox.Items[i]);
AvailableGroupListBox.Items.Remove(AvailableGroupListBox.Items[i]);
i--;
}
}
protected void groupSetLeft_Click(object sender, ImageClickEventArgs e)
{
for (int i = 0; i < myGroupListBox.Items.Count; i++)
{
if (myGroupListBox.Items[i].Selected == true)
{
AvailableGroupListBox.Items.Add(myGroupListBox.Items[i]);
myGroupListBox.Items.Remove(myGroupListBox.Items[i]);
i--;
}
}
}
protected void allGroupSetLeft_Click(object sender, ImageClickEventArgs e)
{
for (int i = 0; i < myGroupListBox.Items.Count; i++)
{
AvailableGroupListBox.Items.Add(myGroupListBox.Items[i]);
myGroupListBox.Items.Remove(myGroupListBox.Items[i]);
i--;
}
}
No comments:
Post a Comment