首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

两个ListBox中怎么互相传值的

2012-01-03 
两个ListBox中如何互相传值的点击按钮就把ListBOx1 中的值传到 ListBOx2中了在点击 就把ListBox2 中的

两个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>        &nbsp; &nbsp;&nbsp;        <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> 

热点排行