ASP.NET中ListBox控件的使用
文章来源:http://www.cnblogs.com/fengzheng126/archive/2012/04/10/2441551.html
ListBox控件属性介绍:
SelectIndex:当前选中的列表项的序号。
SelectItem:当前选中的列表项。
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAc4AAAEpCAIAAACVxVXdAAASXElEQVR4nO3dQWscRxbA8f5O+WKCMHYggYAva+sQxdEh7CU4p4CvgRCSQwLJKZdlQ1iWXXJxDBFqjexYsgmyofcwbKfdVfXqVavnTXe9/w8hZnqqu6fb4p9Sz2jSdACAPWsO/QQAoH7Nvb99zNeSvw79EwJgBsxq7fz555+//fbb77//vt1unw08f/589733xx9/vHjx4vz8nNQCdSC1dkgt4FYmtU0TGTBaGB0zXK4cr3l01Ugt4NZfXWsCnSKjwpguVtswu/2+NBtcNVILuJWZtGqql5r5yobr9t9Tw+pAagG38qlNVU8uo/IqwSi1wjOpAKkF3Ir85i7/1l8UxOxEtb6pqyCV2u1227btdrsltUCt4qntCxidb8p3pZ0lMj1seq1XD7pEai8uLtq2ff/994e1JbVAZaRZbXRJvzwluaf0mxnqq2pUmNpdZ999990PP/zwk08+6WtLaoHKTEztaEB0uSzcflG412iU2l1nN5vNgwcPPv/888ePH3/xxRe72pJaoDLTZ7WpG/HdiEWWn0M1Rqlt2/bk5OTRo0dffvnlt99++/333//444/fffdd27akFqhM5lptp+tsamT2odTGPaR2N6sNMasF6hN5X9dbDyfmuV36EkF8N7rl0QsL1eDNXoBb2t/6ldWLzlKVCQ6zS2pJLVCHqlq2cKQWcIvU2iG1gFuk1g6pBdzK/5Wt8l1cs7xRIfvoqpFawK3bfrKXPDj79lvhbQ/1IbWAW/HwKd/C1fHXYiVILeDWfhua3fgotcrnsFKkFnDrVrNazZxX3lR9U1cBqQXcKp7VjgakJqTKbY5Wr/jqQUdqAccif5irnNiWpjY6pqjUa0dqAbcmzmrDa7LRKwPZcI96ne37qpFawK0ps1rN7fFu+BBFUgs4Jn0KjPArv/LuhOWkltQC9Yl/EF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9qPPvro9PT00aNHX3311Q8//KCf1UZnxL2maXbfU/ph/e3RutFtprYjDOififyE27YtTa39GcgabW10O7vZvaa26Cj0A/T/vjMe4OQjEn62931EpNZOeK12V9vPPvvs66+//umnn9q23W63mmu1r169+jWnaZr+e7g8HBPtkbBlpX5wdq1Xr17pU2t8BoRkz3Wiis5AEeXpUj7t0Wn59e2TY3OAtzmi6M+DwRGRWju71J6dnV1eXvavgG2327Ztv/nmm76zytT+VyfaheGj/ffRQnmbyt0NB2c3W5paeWuppzTLGdDvumj8XlM719MencPwZBoc4C2PKLxrcESk1s4utW3bPnv2bPjWvMvLy4uLi8vLy37Jixcvrq6u5NT+R6dpGmHJ7na/ZHh3tGI0WDtFGxeUptb4DExQuoW9pnaWp33L0zVvaicf0Yw/AKR2iXap3SVV/hOUq6srObUvX778d07TNLvvoeGY/q5wI7rl7EOjJ5B9wi9fvtSn9rBnQKl0df0ZKKI8XfqnHQ5QHulcB7jGIyK1dnapff78eRjWPq9Dcmr/JWqaZnQjfCg1TFhXXr57aEgePFKaWnlrez0DSqWr7zW1Mz7t0bnaxz9xfUdEau3sUhtW9fr6evd9REjt9fX1LzpN04zuDpeMHg0HDBcKohvc3Q63lnJ9fa1PrfEZmKZ0O/ozUERzuvT/xL8M/mUPdYBFPwC/KP4hDI6I1NrZpTZMaoqc2p+rU5raQz/f+e01tYc+uJ9/nu8A13hEpNbOLrXnJVKpvbq6+md1rq6u9Kl1fgaKLOd0zXWAazyi5t7fPuZryV/hv9lms3ny5MnFxcU/KnJxcfHkyRP959U6PwNFFnK6ZjzANR4Rs9r1OT4+Pjk5efr0afhK2no9ffr05OTkWPeB9pyBNf7AzHiAazwiUrtK9+/f32w2RxXZbDb379/nDFT8AzPvAa7uiEgtAOwdqQWAvSO1ALB3pBYA9u5/mgLJ5pOxlaIAAAAASUVORK5CYII=" alt="" />
清除列表框中全部的列表代码:
//获取列表框的选项数
int count = ListBox1.Items.Count;
int index = 0;
//循环列表框中的列表数
for (int i = 0; i < count; i++)
{
ListItem item = ListBox1.Items[index];
//移除列表框中的列表项
ListBox1.Items.Remove(item);
}
//获取下一个选项的索引值
index++;
清除一个或多个列表的代码:
//获取列表框的选项数
int count = ListBox1.Items.Count;
int index = 0;
for (int i = 0; i < count; i++)
{
ListItem item = ListBox1.Items[index];
if (ListBox1.Items[index].Selected==true) //判断当前列表框中选择的列表项
{ ListBox1.Items.Remove(item); //移除当前列表框中选择的列表项
index--;
}
index++;
}
上移代码:
//若不是第一行则上移
if (ListBox1.SelectedIndex > 0 && ListBox1.SelectedIndex <= ListBox1.Items.Count - 1)
{
//保存当前选项的信息
string name = ListBox1.SelectedItem.Text;
string value = ListBox1.SelectedItem.Value;
//获取当前选项的索引号
int index = ListBox1.SelectedIndex;
//交换当前选项与上一项的信息
ListBox1.SelectedItem.Text = ListBox1.Items[index - 1].Text;
ListBox1.SelectedItem.Value = ListBox1.Items[index - 1].Value;
ListBox1.Items[index - 1].Text = name;
ListBox1.Items[index - 1].Value = value;
//设定上一项为当前选项
ListBox1.SelectedIndex--;
}
下移代码:
//若不是最后一行则下移
if (ListBox1.SelectedIndex >= 0 && ListBox1.SelectedIndex <ListBox1.Items.Count - 1)
{
//保存当前选项的信息
string name = ListBox1.SelectedItem.Text;
string value = ListBox1.SelectedItem.Value;
//获取当前选项的索引号
int index=ListBox1.SelectedIndex;
//交换当前选项与下一项的信息
ListBox1.SelectedItem.Text = ListBox1.Items[index + 1].Text;
ListBox1.SelectedItem.Value = ListBox1.Items[index + 1].Value;
ListBox1.Items[index + 1].Text = name;
ListBox1.Items[index + 1].Value = value;
//设定下一项为当前选项
ListBox1.SelectedIndex++;
}
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA00AAAEkCAIAAAB8BU3AAAAcmElEQVR4nO3dQYsj17kGYP3khtB2IIGAN7FnkYkzi+yCswp4GwghWSSQrLK5OIRwuSEbx5Bhuns89syYMDboLgRCqa/q1Cm1zlGdOs+DabrVRyVVtb7Xb5damt0egKv64M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BoiMeVGCl57peVWJGyAy5kUJXnqm51UlboDImBcleOmZnleVuAEiY16U4KVnel5V4gaIjHlRgpee6XlViRsgMuZFCV56pudVJW6AyJgXJXjpmZ5XlbgBImNelOClZ3peVeIGiIx5UYKXnul5VYkbIDLmRQleeqbnVSVugMiYFyV46ZmeV5W4ASJjXpTgpWd6XlXiBoiMeVGCl57peVWJGyAy5kUJXnqm51UlboDImBcleOmZnleVuAEiY16U4KVnel5V4gaIjHlRgpee6XlViRsgMuZFCV56pudVJW6AyJgXJXjpmZ5XlbgBImNelOClZ3peVeIGiIx5UYKXnul5VYkbIDLmRQleeqbnVSVugMiYFyV46ZmeV5W4ASJjXpTgpWd6XlXiBoiMeVGCl57peVWJGyAy5kUJXnqm51UlboDImBcleOmZnleVuAEiY16U4KVnel5V4gaIjHlRgpee6XlViRsgMuZFCV56pudVJW6AyJgXJXjpmZ5XlbgBImNelOClZ3peVeIGiIx5UYKXnul5VYkbIDLmRQleeqbnVSVugMiYFyV46ZmeV5W4ASJjXpTgpWd6XlXiBoiMeVGCl57peVWJGyAy5kUJXnqm51UlboDImBcleOmZnleVuAEiY16U4KVnel5V4gaIjHlRgpee6XlViRsgMuZFCV56pudVJW6AyJgXJXjpmZ5XlbgBImNelOClZ3peVeIGiIx5UYKXnul5VYkbIDLmRQleeqbnVSVugMiYFyV46ZmeV5W4ASJjXpTgpWd6XlXiBoiMeVGCl57peVWJGyAy5kUJXnqm51UlboDImBcleOmZnleVuAEiY16U4KVnel5V4gaIjHlRgpee6XlViRsgMuZFCV56pudVJW6AyJgXJXjpmZ5XlbgBImNelOClZ3peVeIGiIx5UYKXnul5VYkbIDLmRQleeqbnVSVugMiYFyV46ZmeV5W4ASJjXpTgpWd6XlXiBoiMeVGCl57peVWJGyAy5kUJXnqm51UlboDImBcleOmZnleVuAEiY16U4KVnel5V4gaIjHlRgpee6XlViRsgMuZFCV56pudVJW6AyJgXJXjpmZ5XlbgBImNelOClZ3peVeIGiIx5UYKXnul5VYkbID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np1fOPwCKZhyv/bscFmXt6qR3c2B7peUVVDt7MR1FmVKa/TH+r8lQucnNz8+bNm78tsdvtLrLscJCPK08/ptefd6ODb+WvTC8+9ebNGz1vLQ5x8+rVqxgux4g5lY6bdMFP/5qSXpa4bvryv4ffwNKLB5b2vPTWih6BTEuvXrTnXfBuD45ViR9xV3uk5xVVM3jzH3g5UZlzyei3rjKVixx63l+X2O12j1l2PNRx2enl8SqPvNHMlZl3aZSetyKHuInJ8ubNm8PHgUTc5P8mFH+ZOL1k9BeIqQsTRje4m/s9aSD9YL3uETjP0u3kH4FFcg5X/o/4byc/2Wvt4NKTAbP387p7pOcVVTN4S0RlK1O5yM3NzevXrz9bYrfbXWpZXHO85PTwXuq+JX6CcSNLb/qzzz57/fq1nrcWh7iJsTIlHTeZTb8hS3vete/v5RXtedfeub/+9XI7uLE90vOKErxpV+l5t7e3n3/++f39/f/wOPf3959//vnt7e3UodbzqjrEzYslpuJm6W9CTUj/UuIInG09h+tSO7ixPdLzihK8aYViJ+3JkydPnz794osv4vPmLPLFF188ffr0yZMnU4d698GPf+q/lf8Xf2yb/E1o9pcSR+BsKzlcF9zBje3R1UPGf/G/1T7qLqtc7Mz68MMPb29vb3ic29vbDz/8MHGcnc9r0iZ/E5r9pcQRaP0Bc8Ed3N4esX4redRdlsfw5ul5rdreb0Kzv5Q4Aq0/YC67g9vbI9ZvDY+6y/IY3rz/BzrjG1XDMkQ+AAAAAElFTkSuQmCC" alt="" />
左边为目标列表框,右边为源列表框。
全部左移代码:
int count = ListBox2.Items.Count;
int index = 0;
for (int i = 0; i < count; i++)
{
ListItem item = ListBox2.Items[index];
ListBox2.Items.Remove(item);
ListBox1.Items.Add(item);
}
index++;
单个或多个右移代码:
int count = ListBox2.Items.Count;
int index = 0;
for (int i = 0; i < count; i++)
{
ListItem item = ListBox2.Items[index];
if (ListBox2.Items[index].Selected == true)
{ ListBox2.Items.Remove(item);
ListBox1.Items.Add(item);
index--;
}
index++;
}
ASP.NET中ListBox控件的使用的更多相关文章
- [转载]ASP.NET中TextBox控件设立ReadOnly="true"后台取不到值
原文地址:http://www.cnblogs.com/yxyht/archive/2013/03/02/2939883.html ASP.NET中TextBox控件设置ReadOnly=" ...
- MFC中Listbox控件的简单使用
MFC中listbox控件是为了显示一系列的文本,每个文本占一行. Listbox控件可以设置属性为: LBS_CHILD :(默认)子窗口 LBS_Visible :(默认)可视 LBS_M ...
- 轻松学习Asp.net中的控件
C/S 结构,即大家熟知的客户机和服务器结构.它是软件系统体系结构,通过它可以充分利用两端硬件环境的优势,将任务合理分配到Client端和Server端来实现,降低了系统的通讯开销.目前大多数应用软件 ...
- WPF中ListBox控件在选择模式(SelectionMode)为Single时仍然出现多个Item被选中的问题
最近在学习WPF过程中使用到了ListBox控件,在使用时遇到下面的奇怪问题: 代码如下: listBox.Items.Add("绘图"); listBox.Items.Add(& ...
- asp.net中Repeater控件用法笔记
大家可能都对datagrid比较熟悉,但是如果在数据量大的时候,我们就得考虑使用 repeater作为我们的数据绑定控件了.Repeater控件与DataGrid (以及DataList)控件的主要区 ...
- MFC中listbox控件中各种属性的详解
ListBox控件是Windows 窗体的一个空间,ListBox 控件显示一个项列表,用户可从中选择一项或多项. 如果项总数超出可以显示的项数,则自动向 ListBox 控件添加滚动条. ...
- Asp.Net中ObjectDataSource控件传参绑定数据
最近在实习,在上头交付的任务中,由于需要使用Asp.Net的ListView控件,因此必然得就使用了ObjectDataSource控件,由于在使用过程中,需要网页中的参数发送到后台后,运行该参数进行 ...
- 十三、asp.net中Repeater控件用法笔记
大家可能都对datagrid比较熟悉,但是如果在数据量大的时候,我们就得考虑使用 repeater作为我们的数据绑定控件了.Repeater控件与DataGrid (以及DataList)控件的主要区 ...
- ASP.NET中TextBox控件设立ReadOnly="true"后台取不到值
SP.NET中TextBox控件设置ReadOnly="true"H或Enabled=false后台取不到值 当TextBox设置了ReadOnly="true" ...
随机推荐
- 护眼纯黑色VS2012配色方案
这些天由于公司项目比较忙,所以天天盯着电脑8小时,而且我的开发工具VS2012是白色背景的所以每天下班都搞的眼睛巨疼. 今天在网上找到一个很好的配色方案,所以有同样烦恼的童鞋们可以试试哦! 展示下效果 ...
- ios开发屏幕问题
1. 程序要要支持Iphone 和 ipad,所以首先必需创建一通用程序,这一操作只要在创建程序时在 devices那栏上勾选universal即可,完成后会发现有两个.xib文件,但只有一个view ...
- sqlserver 注释提取工具
小程序大智慧,sqlserver 注释提取工具 开篇背景 我习惯在写表的创建脚本时将注释直接写在脚本里,比如 ? /*账套*/ CREATE TABLE [dbo].[AccountingBook] ...
- 设置 Ext.data.Store 传参的请求方式
设置 Ext.data.Store 传参的请求方式 1.extjs 给怎么给panel设背景色 设置bodyStyle:'background:#ffc;padding:10px;', var res ...
- iOS上线项目源码分享
最强UINavigationController和TabBar结合(会员satian ) 最强UINavigationController和TabBar结合的Demo,这里取用了明星衣橱app里的 ...
- 12503 - Robot Instructions
Robot Instructions You have a robot standing on the origin of x axis. The robot will be given som ...
- 用android代码显示图片的一部分源码
ShowPoritionPictureActivity代码: [java] <span style="font-size:16px;"> package com.iwi ...
- Android消息推送之GCM方式(一)
<声明> 转载请保留本来源地址: http://blog.csdn.net/wzg_1987/article/details/9140371 首先,你需要使用一个谷歌账号登录谷歌Api控制 ...
- [置顶] java得到前一个月的年月日时分秒
import java.util.Calendar; /** * 得到前一个月的年月日时分秒 * @author Mr.hu * 2013-6-28上午12:00:35 * Class Explain ...
- JS高程5.引用类型(5)Array类型的操作方法
一.操作方法 1.concat()方法 基于当前数组中的所有项创建一个新数组.具体说,是先创建当前数组的一个副本,然后将接收到的参数添加到这个副本的末尾,最后返回新构建的数组.在没有给concat() ...