zoukankan      html  css  js  c++  java
  • c# 绑定checkboxlist 数据库的值函数

    public void BindCheckBoxList(CheckBoxList cbl, bool isText, string values)
            {
                values = string.IsNullOrEmpty(values) ? ("") : (values);
                if (values.Length > 0)
                {
                    if (isText)
                    {
                        string[] tempValues = values.Split(',');
                        for (int i = 0; i < tempValues.Length; i++)
                        {
                            for (int j = 0; j < cbl.Items.Count; j++) {
                                if (cbl.Items[j].Text.Trim() == tempValues[i].ToString())
                                {
                                    cbl.Items[j].Selected = true;
                                }
                            }
                        }
                    }
                    else {
                        string[] tempValues = values.Split(',');
                        for (int i = 0; i < tempValues.Length; i++)
                        {
                            for (int j = 0; j < cbl.Items.Count; j++)
                            {
                                if (cbl.Items[j].Value.Trim() == tempValues[i].ToString())
                                {
                                    cbl.Items[j].Selected = true;
                                }
                            }
                        }
                    }
                  
                }
                else {

                }
            }

  • 相关阅读:
    CSS躬行记(9)——网格布局
    CSS躬行记(8)——裁剪和遮罩
    CSS躬行记(7)——合成
    CentOS 系统目录解析
    Linux 命令快捷键
    秒的精确度
    Oracle和mysql中装逼dual表的用途介绍
    mysql 的mgr集群
    ansible笔记
    cygwin
  • 原文地址:https://www.cnblogs.com/bestsaler/p/1835700.html
Copyright © 2011-2022 走看看