读书人

两个ListBox中怎么互相传值的

发布时间: 2012-01-03 22:16:06 作者: rapoo

两个ListBox中如何互相传值的
点击按钮 >> 就把ListBOx1 中的值传到 ListBOx2中了
在点击 < < 就把ListBox2 中的值消除了.
这东西谁有现成的代码. 不要JS 最好是后台代码
谢谢

[解决办法]

我写了一个,你试一下吧, VS2005

HTML code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server">    <title>无标题页</title></head><body>    <form id="form1" runat="server">    <div>                    <table style="width: 682px; height: 301px">            <tr>                <td style="width: 100px">                    <asp:ListBox ID="ListBox1" runat="server" Height="170px" Width="308px">                        <asp:ListItem>1</asp:ListItem>                        <asp:ListItem>2</asp:ListItem>                        <asp:ListItem>3</asp:ListItem>                    </asp:ListBox></td>                <td style="width: 100px">                    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text=">>" Width="78px" /><br />                    <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="<<" Width="79px" /></td>                <td style="width: 100px">                    <asp:ListBox ID="ListBox2" runat="server" Height="170px" Width="137px"></asp:ListBox></td>            </tr>        </table>        </div>    </form></body></html> 

读书人网 >asp.net

热点推荐