文件名称:ListBox实现双向选择
文件大小:2KB
文件格式:RAR
更新时间:2014-10-04 03:25:20
ListBox、双向选择
//往LB2添加 for (int i = 0; i < this.LB1.Items.Count; i++) { if (LB1.Items[i].Selected == true) { //Menu menu = (Menu)this.LB1.Items[i]; //this.LB2.Items.Add(menu); ListItem item = new ListItem(); item = this.LB1.Items[i]; this.LB2.Items.Add(item); } } //去除LB1中数据 for (int i = this.LB1.Items.Count - 1; i >= 0; i--) { if (LB1.Items[i].Selected == true) { //Menu menu = (menu)this.LB1.SelectedItems[i]; //this.LB1.Items.Remove(menu); ListItem item = new ListItem(); item = this.LB1.Items[i]; this.LB1.Items.Remove(item); } }
【文件预览】:
Default.aspx
Default.aspx.cs