制作可上下左右移动的 ListBox:
方法:
1.新建页面,拖放如下控件: 两个ListBox ,6个button,样式如下
各个button的功能
>> 左移
<< 右移
↑上移
↓下移
C全部清空
>> 代码如下:
protected void Button1_Click(object sender, EventArgs e)
{
try
{
this.ListBox2.Items.Add(this.ListBox1.SelectedItem.Text.ToString());
}
catch (Exception)
{
// this.Response.Write("<script language=javascript>alert('Please select some items before you click it!');history.go(-1)</script>");
}
}
<<代码如下:
protected void Button2_Click(object sender, EventArgs e)
{
try
{
this.ListBox2.Items.Remove(this.ListBox2.SelectedIte