小项目之总结CheckBoxList读取值

       取值
        
string _strvalue="";
          
for (int i = 0; i < chk_td.Items.Count; i++)
            {
                
if (chk_td.Items[i].Selected == true)
                {
                    _strvalue
+= chk_td.Items[i].Value + "|";
                }
            }
            
if (_strvalue.Length > 1) _strvalue = _strvalue.Substring(0, _strvalue.Length - 1);

     读取
               
string aa = 数据库读取值;
                
string[] strtemp = aa.Split('|');
                
foreach (string str in strtemp)
                {
                    
for (int i = 0; i < chk_td.Items.Count; i++)
                    {
                        
if (chk_td.Items[i].Value == str)
                        {
                            chk_td.Items[i].Selected 
= true;
                        }
                    }
                }

相关文章:

  • 2021-07-18
  • 2022-12-23
猜你喜欢
  • 2021-09-17
  • 2021-10-17
  • 2021-11-02
  • 2021-07-27
  • 2021-12-18
相关资源
相似解决方案