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 {

            }
        }

相关文章:

  • 2022-12-23
  • 2021-12-26
  • 2021-08-01
  • 2022-12-23
  • 2022-02-15
猜你喜欢
  • 2022-12-23
  • 2021-07-26
  • 2022-02-16
  • 2022-12-23
  • 2021-06-06
  • 2021-11-16
  • 2021-10-07
相关资源
相似解决方案