I developed a webpage in which I used the following code to move the selected items between two list boxes.
It is very slow.
Is there any optimization for this?
protected void MovetoNext_Click(object sender, EventArgs e)
{
try
{
for (int i = 0; i < lstCategory.Items.Count; i++)
{
if (lstCategory.Items[i].Selected)
{
lstCategory.Items[i].Selected = false;
lstSelCategory.Items.Add(lstCategory.Items[i]);
lstCategory.Items.RemoveAt(i);
i = i - 1;
}
}
}
catch (Exception ex)
{
}
}