CheckedComboBoxEditExtension
public static class CheckedComboBoxEditExtension
{
public static void BindData(this CheckedComboBoxEdit control, IList<NameValue<string>> collection, bool isShowButtons = true)
{
if (collection == null)
return;
control.Properties.Items.Clear();
control.Properties.ShowButtons = isShowButtons;
control.Properties.NullText = null;
control.Cursor = System.Windows.Forms.Cursors.Hand;
foreach (var item in collection)
{
control.Properties.Items.Add(new CheckedListBoxItem(item.Value, item.Name, CheckState.Unchecked));
}
control.CustomDisplayText += (sender, e) =>
{
var selectedCount = control.Properties.GetCheckedItems().ToString().Replace(", ", ",").Split(',').ToList().Count;
if (selectedCount == collection.Count)
{
e.DisplayText = "全部";
}
}; } public static void BindData(this CheckedComboBoxEdit control, IList<NameValue> collection, bool isShowButtons = true)
{
if (collection == null)
return;
control.Properties.Items.Clear();
control.Properties.Items.Clear();
control.Properties.ShowButtons = isShowButtons;
control.Properties.NullText = null;
control.Cursor = System.Windows.Forms.Cursors.Hand;
foreach (var item in collection)
{
control.Properties.Items.Add(new CheckedListBoxItem(item.Value, item.Name, CheckState.Unchecked));
}
control.CustomDisplayText += (sender, e) =>
{
var selectedCount = control.Properties.GetCheckedItems().ToString().Replace(", ", ",").Split(',').ToList().Count;
if (selectedCount == collection.Count)
{
e.DisplayText = "全部";
}
}; }
public static void Clear(this CheckedComboBoxEdit control)
{
control.Properties.Items.Clear();
} public static bool IsSelected(this CheckedComboBoxEdit control)
{
if (control.EditValue == null || control.EditValue.ToString().Equals(string.Empty))
{
return false;
}
return !control.EditValue.Equals("-999");
} public static bool IsNotSelected(this CheckedComboBoxEdit control)
{
return !control.IsSelected();
} /// <summary>
/// 获取多选下拉框值List
/// </summary>
/// <param name="control"></param>
/// <returns></returns>
public static IList<string> GetCheckedValueLists(this CheckedComboBoxEdit control)
{
return control.Properties.GetCheckedItems().ToString().Replace(", ", ",").Split(new string[] { ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
}
/// <summary>
/// 获取多选下拉框值,多个值用","连接 ;注意 当取得值是多项时,各项之间的间隔是 英文状态下 逗号+空格
/// </summary>
/// <param name="control"></param>
/// <returns></returns>
public static string GetCheckedValuestrs(this CheckedComboBoxEdit control)
{
return control.Properties.GetCheckedItems().ToString().Replace(", ", ",");
}
}
CheckedComboBoxEditExtension的更多相关文章
随机推荐
- mysql 数据库远程访问设置方法
			摘自: http://www.iteye.com/topic/418151 mysql数据库远程访问设置方法 1.修改localhost更改 "mysql" 数据库里的 " ... 
- IOS sqlite数据库增删改查
			1.简单介绍 简单封装sqlite数据库操作类 BaseDB 用于完毕对sqlite的增删改查.使用前先导入libsqlite3.0.dylib库 2.BaseDB.h // // BaseDB.h ... 
- python使用md5处理下载图片
			import urllib2 import hashlib opener = urllib2.build_opener() req = opener.open("http://avatar. ... 
- Struts2远程代码执行漏洞预警
			近期struts2 框架再现高危远程命令执行漏洞,漏洞编号S2-045,CVE编号CVE-2017-5638.利用此漏洞可对使用了struts2框架的网站进行远程命令执行,对服务器造成威胁.请相关单位 ... 
- Java中执行存储过程和函数(web基础学习笔记十四)
			一.概述 如果想要执行存储过程,我们应该使用 CallableStatement 接口. CallableStatement 接口继承自PreparedStatement 接口.所以CallableS ... 
- Java File 与 Bytes相互转换
			public static byte[] fileToBytes(String filePath) { byte[] buffer = null; File file = new File(fileP ... 
- Starting MySQL.. ERROR! The server quit without updating PID file (/gechong/mysqldata/10-9-23-119.pid).
			配置文件修改错误了,还原一下重启服务就OK了. # /etc/init.d/mysql start 
- use of _track and track_visibility
			Dosen't work...the followers don't recieve an email when the state is change. Here is the code in th ... 
- android缓存具体解释
			Android缓存: 採用缓存,能够进一步大大缓解数据交互的压力.又能提供一定的离线浏览.下边我简略列举一下缓存管理的适用环境: 1. 提供网络服务的应用 2. 数据更新不须要实时更新,哪怕是3-5分 ... 
- exception PLS-00403: expression 'V_END' cannot be used as an INTO-target of a SELECT/FETCH statement
			exception PLS-00403: expression 'V_END' cannot be used as an INTO-target of a SELECT/FETCH stateme ... 
