zoukankan      html  css  js  c++  java
  • CheckBoxList取值及勾选上

                string strrighgs = "";
                
    for (int i = 0; i < this.cblrighgs.Items.Count; i++)
                
    {
                    
    if (this.cblrighgs.Items[i].Selected == true)
                    
    {
                        strrighgs 
    += this.cblrighgs.Items[i].Value+"|";
                    }

                }


                
    string str = "";
                
    foreach (ListItem li in cblrighgs.Items)
                
    {
                    
    if (li.Selected == true)
                    
    {
                        str 
    += li.Value+";";
                    }

                }


                Response.Write(str);
                Response.End();
    勾选上:
                string[] strtemp = strapp.Split('|');
                
    foreach (string str in strtemp)
                
    {
                    
    for (int i = 0; i < cblrighgs.Items.Count; i++)
                    
    {
                        
    if (this.cblrighgs.Items[i].Value == str)
                        
    {
                            
    this.cblrighgs.Items[i].Selected = true;
                        }

                    }

                }
  • 相关阅读:
    Javaweb学习12.4
    Javaweb学习11.23
    Javaweb学习11.29
    Javaweb学习12.3
    Javaweb学习12.1
    Javaweb学习11.27
    2020年8月25日Java学习日记
    2020年8月18日Java学习日记
    2020年8月22日Java学习日记
    2020年8月21日Java学习日记
  • 原文地址:https://www.cnblogs.com/cnaspnet/p/751293.html
Copyright © 2011-2022 走看看