//得到选中的项
            string strType = "";//车损损失类别
            if (this.cbc_lost_type_ids.CheckedItems.Count > 0)
            {
                foreach (System.Data.DataRowView item in this.cbc_lost_type_ids.CheckedItems)
                {
                    strType += item.Row["DICT_KEY"].ToString() + ",";
                }
            }

 //根据值使复选框选中
                int icount = cbc_lost_type_ids.ItemCount;
                string[] strType = dt.Rows[0]["lost_type_ids"].ToString().Split(',');//车损损失类别
                for (int i = 0; i < icount; i++)
                {
                    for (int j = 0; j < strType.Length; j++)
                    {
                        if (cbc_lost_type_ids.GetItemValue(i).ToString() == strType[j].ToString())
                        {
                            cbc_lost_type_ids.SetItemChecked(i, true);
                        }
                    }
                }

posted on 2011-03-23 17:01  张@天  阅读(593)  评论(0编辑  收藏  举报