asp界面
<div>
<asp:ListBox ID="lstLeft" runat="server" SelectionMode="Multiple">
<asp:ListItem Value="hunan">湖南</asp:ListItem>
<asp:ListItem Value="HeNan">河南</asp:ListItem>
<asp:ListItem Value="BeiJing">北京</asp:ListItem>
<asp:ListItem Value="ShangHai">上海</asp:ListItem>
</asp:ListBox>
<asp:Button ID="btnMove" runat="server" OnClick="btnMove_Click" Text=">" />
<asp:ListBox ID="lstRight" runat="server" SelectionMode="Multiple"></asp:ListBox>
</div>
后台界面
protected void btnMove_Click(object sender, EventArgs e)
{
for(int i=0;i<lstLeft.Items.Count;i++) //遍历左边列表框中所有项
{
if(lstLeft.Items[i].Selected) //判断数据项是否选中
{
lstRight.Items.Add(lstLeft.Items[i]); //向右边列表框添加选中的一项
lstLeft.Items.Remove(lstLeft.Items[i]);
i--; //调整左边列表框中剩余项索引号
}
}
}