设置 CheckBoxList (多个值,用,分隔)选中 - CheckBoxListSetSelectedByIds

2017-02-19 13:58:51  访问(1563) 赞(0) 踩(0)



        /// <summary>
        /// 设置 CheckBoxList (多个值,用,分隔)选中 - CheckBoxListSetSelectedByIds
        /// </summary>
        /// <param name="extAspNetCheckBoxList"></param>
        /// <param name="strIds"></param>
        public void CheckBoxListSetSelectedByIds
            (
                FineUI.CheckBoxList extAspNetCheckBoxList, 
                string strIds
            )
        {
            if (strIds == null || strIds.Length == 0)
            {
                foreach (FineUI.CheckItem item in extAspNetCheckBoxList.Items)
                {
                    item.Selected = false;
                }
            }
            else
            {
                string strValue = "," + strIds + ",";

                foreach (FineUI.CheckItem item in extAspNetCheckBoxList.Items)
                {
                    if (strValue.Contains("," + item.Value + ","))
                    {
                        item.Selected = true;
                    }
                    else
                    {
                        item.Selected = false;
                    }
                }
            }
        }


标签:设置 CheckBoxList (多个值,用    分隔)选中 - CheckBoxListSetSelectedByIds 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)
 
  ┈全部┈  
 
(显示默认分类)