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的更多相关文章
随机推荐
- 如何使用动画和精灵表单 Cocos2d-x 2.1.4
本文实践自 Ray Wenderlich.Tony Dahbura 的文章< How to Use Animations and Sprite Sheets in Cocos2D ...
- 应用程序在状态栏展示时间(C#)
private DispatcherTimer _timer; private void SetTimeElaspInStatusBar() { try { _timer = new Dispatch ...
- [Sass] Level 4: Extend -- Ex
Better use @extend with % placeholder. Extend is useful when you want to reuse some of you class. Al ...
- 用10046 跟踪exp
之前写过一个blog,Oracle expdp为什么比exp快,原理是什么,是从官方文档中获知的,如今通过10046来分析exp的过程. C:\Users\Administrator>exp L ...
- TP框架中APP_SUB_DOMAIN_DEPLOY什么意思?
'APP_SUB_DOMAIN_DEPLOY' => false, // 是否开启子域名部署 thinkphp开启域名部署/子域名部署/泛域名部署/IP访问部署 Think ...
- 网页中的图片查看器viewjs使用
需求分析: 对于网页中的图片进行连续放大(便于用户清晰查看内容).缩小,旋转等操作,可以使用viewjs图片查看器插件实现. viewjs官方网址:https://github.com/fengyua ...
- iOS调试证书/公布证书制作
当已经注冊过applied 开发人员账号后,而且进行付款了,那么接下来就是证书制作了 1.登录membercenter https://developer.apple.com/membercenter ...
- windows 配置ftp server
- MariaDB与MySQL并存
以下是MariaDB官方文档说明,MariaDB如何安装在已经存在MySQL实例的主机上: https://mariadb.com/kb/en/library/installing-mariadb-a ...
- jsp页面获取集合的长度
createTime--2016年10月12日16:20:02Author:Marydonjsp页面获取集合的长度 在jsp页面与js中不能通过${list.size}取列表长度,而是引入jstl ...