R2DatagridViewTreeViewSelectColumn treAss = new R2DatagridViewTreeViewSelectColumn();
treAss.Width = 150;
treAss.HeaderText = css.FEILD_CHNAME;
treAss.Name = "col" + css.FILED_NAME;
treAss.DataPropertyName = css.FILED_NAME;
treAss.OnlySelectLeaf = true;
treAss.OnlySelectEnabled = true;
treAss.IsTextBoxEnabled = false;
treAss.FindParentMode = RFindParentNodeMode.ParentID;
treAss.NodeCodeMember = "Code";
treAss.NodeIDMember = "Id";
treAss.NodeNameMember = "Name";
treAss.NodeParentIDMember = "Parent_id";
treAss.FindParentMode = RFindParentNodeMode.ParentID;
switch (css.TABLE_ELEMENT)
{
case "GFM_ASS_ELE_CARD_PERSON":
List<Person> userDepartList = new List<Person>();
//if (css.FEILD_CHNAME == "使用人")
//{
userDepartList = AgencyManage.Instance.AllPerList.OrderBy(a => a.Code).ToList();
//}
if (css.FEILD_CHNAME == "使用人" && (Global.userRoleId.ToString().Equals("6603") || Global.userRoleId.ToString().Equals("6501")))
{
userDepartList = userDepartList.FindAll(a => a.DEPARTMENT_ID.Contains(comeDepId));
}
List<Person> personList = userDepartList.ToList();
treAss.DataList = personList;
break;
case "GFM_ASS_ELE_DEPARTMENT":
treAss.OnlySelectLeaf = false;
List<Department> dtList = AgencyManage.Instance.DepListByRole;
comeDepId = dtList[0].Id.ToString();
treAss.DataList = dtList.OrderBy(a => a.Code).ToList();
break;}
treAss.Tag = css;
dgvAssetList.Columns.Add(treAss);
然后想如果选了使用部门,那么使用人就应该是该使用部门下的人员
然后我发现赋值是直接赋给一整列了
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
楼主可以去看下WPF中得数据绑定,这个可以完美解决你得问题
1.告诉你一个笨拙而常见的方式:参见WPF中的INotifyPropertyChanged接口。
这样你就有了事件,剩下的就不用说了。
2.还有个很爽的办法——基于控件重写,就是把Item绘制直接基于 数据,编辑时去修改 原数据,完成后使重绘即可。
3.笨办法,定位,当然用引用定位最好,而不是索引。
方法1对于新手难度较小;
你这控件明显是第三方的,细节自己思考,追问基本不会有结果。
((grp.pt.control.R2DatagridViewTreeViewSelectCell)dgvAssetList.Rows[rowIndex].Cells["colUSE_USER_ID"]).DataList = listperson;
给单元格赋数据源