两个listbox中的值传递,第一个listbox数据绑定的字段,从第一个listbox选中的项移动到第二个listbox中,然后将第二个listbox中的值写进另一个表中,现在我取不到第二个listbox中的值,写不到表中,求大虾指点!!!
------解决方案--------------------------------------------------------
- C# code
rotected void btnSet_Click(object sender, EventArgs e) { foreach (ListItem item in lbCxLeft.Items) { if (item.Selected) { lbCxRight.Items.Add(item); } } foreach (ListItem item in lbCxRight.Items) { if (lbCxLeft.Items.FindByValue(item.Value) != null) { lbCxLeft.Items.Remove(item); } } } protected void btnSetAll_Click(object sender, EventArgs e) { foreach (ListItem item in lbCxLeft.Items) { lbCxRight.Items.Add(item); } lbCxLeft.Items.Clear(); } protected void btnDel_Click(object sender, EventArgs e) { foreach (ListItem item in lbCxRight.Items) { if (item.Selected) { lbCxLeft.Items.Add(item); } } foreach (ListItem item in lbCxLeft.Items) { if (lbCxRight.Items.FindByValue(item.Value) != null) { lbCxRight.Items.Remove(item); } } } protected void btnDelAll_Click(object sender, EventArgs e) { foreach (ListItem item in lbCxRight.Items) { lbCxLeft.Items.Add(item); } lbCxRight.Items.Clear(); }