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 {

            }
        }

posted on 2009-04-07 16:20 sanmao 阅读(293) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
 

常用链接

留言簿(5)

随笔分类

随笔档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜