分类: C#/.net
2013-08-14 14:13:57
//清楚全部
protected void btnClear_Click(object sender, EventArgs e)
{
int count = listSend.Items.Count;
int index = 0;
for (int i = 0; i < count; i++)
{
ListItem item = listSend.Items[index];
listSend.Items.Remove(item);
}
index++;
}
//右移
protected void btnAddRight_Click(object sender, EventArgs e)
{
if (listYuan.SelectedIndex <= -1)
{
Common.ShowAlter(this.Page, "提示", "请选择要要右移的数据");
return;
}
int count = listYuan.Items.Count;
int index = 0;
for (int i = 0; i < count; i++)
{
ListItem item = listYuan.Items[index];
if (item.Selected == true)
{
listYuan.Items.Remove(item);
listSend.Items.Add(item);
this.listSend.SelectedIndex = (listSend.Items.Count - 1);
index--;
}
index++;
}
}
//左移
protected void btnAddLeft_Click(object sender, EventArgs e)
{
int count = listSend.Items.Count;
int index = 0;
for (int i = 0; i < count; i++)
{
ListItem item = listSend.Items[index];
if (item.Selected == true)
{
listSend.Items.Remove(item);
listYuan.Items.Add(item);
this.listYuan.SelectedIndex = (this.listYuan.Items.Count - 1);
index--;
}
index++;
}
}