列表选择listbox1-->listbox2

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="OverTime.aspx.cs" Inherits="OverTime" %>

<!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 id="Head1" runat="server">
<title>Untitled Page</title>
<style type="text/css">
#div1
{
width: 606px;
height: 400px;
border: 1px solid #ffffff;
}
#div2
{
position: absolute;
left: 5px;
width: 200px;
height: 400px;
border: 1px solid #ffffff;
}
#div3
{
top: 150px;
text-align: center;
position: absolute;
left: 205px;
width:50px;
height: 100px;
border: 1px solid #ffffff;
}
#div4
{
position: absolute;
left: 255px;
width: 200px;
height: 400px;
border: 1px solid #ffffff;
}

</style>
</head>
<body>
<form id="form1" runat="server">
<br />
<br />
<br />
班组:<br />
<asp:DropDownList ID="DropDownList1" runat="server" Height="40px" Width="188px"
AutoPostBack="True" DataSourceID="SqlDataSource1" DataTextField="bm_name"
DataValueField="bm_name">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="Data Source=SRV-KS-DB;Initial Catalog=form_new1;Persist Security Info=True;User ID=ten;Password=19850610"
ProviderName="System.Data.SqlClient"
SelectCommand="SELECT [bm_name] FROM [All_bm]"></asp:SqlDataSource>
<div id="div1">
<div id="div2">
<asp:ListBox ID="ListBox1" runat="server" Height="390px" Width="190px"
DataSourceID="SqlDataSource2" DataTextField="ry_name" DataValueField="ry_name"
></asp:ListBox>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="Data Source=SRV-KS-DB;Initial Catalog=form_new1;Persist Security Info=True;User ID=ten;Password=19850610"
ProviderName="System.Data.SqlClient"
SelectCommand="SELECT [ry_name] FROM [All_user] WHERE ([bm_name] = @bm_name)">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="bm_name"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</div>
<div id="div3">
<table cellpadding="0" cellspacing="0" >
<tr>
<td>

</td>
</tr>
<tr>
<td>
<asp:Button ID="Button1" runat="server" Text=">" Width="25px"
οnclick="Button1_Click" />
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button2" runat="server" Text=">>" Width="25px"
οnclick="Button2_Click" />
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button3" runat="server" Text="<" Width="25px"
οnclick="Button3_Click" />
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button4" runat="server" Text="<<" Width="25px"
οnclick="Button4_Click" />
</td>
</tr>
</table>
</div>
<div id="div4">
<asp:ListBox ID="ListBox2" runat="server" Height="390px" Width="190px"></asp:ListBox>
</div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></div>
</form>
</body>
</html>
--------------------------------------------------
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class OverTime : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{


}
protected void Button1_Click(object sender, EventArgs e)
{
for (int i = 0; i < ListBox1.Items.Count; i++)
{
if (ListBox1.Items[i].Selected == true)
{
ListBox2.Items.Add(new ListItem(ListBox1.Items[i].Text, ListBox1.Items[i].Value));
ListBox1.Items.Remove(ListBox1.Items[i].Value);
}
}
}
protected void Button3_Click(object sender, EventArgs e)
{
for (int i = 0; i < ListBox2.Items.Count; i++)
{
if (ListBox2.Items[i].Selected == true)
{
ListBox1.Items.Add(new ListItem(ListBox2.Items[i].Text, ListBox2.Items[i].Value));
ListBox2.Items.Remove(ListBox2.Items[i].Value);
}
}
}
protected void Button2_Click(object sender, EventArgs e)
{
ListBox1.DataBind();
ListBox2.DataSource = ListBox1.Items;
ListBox2.DataBind();
ListBox1.Items.Clear();
}
protected void Button4_Click(object sender, EventArgs e)
{
ListBox2.Items.Clear();
ListBox1.DataBind();
}
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
<form class="ant-form ant-form-horizontal"><div class="ant-row ant-form-item"style="row-gap: 0px;"><div class="ant-col ant-form-item-label"style="width: 100px;"><label for="form_item_licDetailType"class="ant-form-item-required"title="license类型">license类型<!----></label></div><div class="ant-col ant-form-item-control"><div class="ant-form-item-control-input"><div class="ant-form-item-control-input-content"><div class="ant-select ant-select-single ant-select-allow-clear ant-select-show-arrow"><!----><div class="ant-select-selector"><span class="ant-select-selection-search"><input type="search"id="form_item_licDetailType"autocomplete="off"class="ant-select-selection-search-input"role="combobox"aria-haspopup="listbox"aria-owns="form_item_licDetailType_list"aria-autocomplete="list"aria-controls="form_item_licDetailType_list"aria-activedescendant="form_item_licDetailType_list_0"readonly=""unselectable="on"style="opacity: 0;"aria-expanded="false"></span><!----><span class="ant-select-selection-placeholder">请选择</span></div><span class="ant-select-arrow"unselectable="on"aria-hidden="true"style="user-select: none;"><span role="img"aria-label="down"class="anticon anticon-down ant-select-suffix"><svg focusable="false"class=""data-icon="down"width="1em"height="1em"fill="currentColor"aria-hidden="true"viewBox="64 64 896 896"><path d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"></path></svg></span></span><!----></div></div><!----></div><!----><!----></div></div></form> 请进行selemiu 元素定位
07-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值