Dev表格RepositoryItemLookUpEdit组件改变值时设置其它列的值-原创
Dev表格RepositoryItemLookUpEdit组件改变值时设置其它列的值-原创
注意:绑定RepositoryItemLookUpEdit数据源的DisplayMember,ValueMember属性,
要绑定ID编号字段,界面效果如下图:
C# Code:
private void gvDetail_CellValueChanging(object sender, CellValueChangedEventArgs e)
{
if (this.IsAddOrEditMode)
{
if (e.Column == colD_WorkTypeID)//工种
{
object o = repWorkType.GetDataSourceValue("TypeName", repWorkType.GetDataSourceRowIndex("TypeID", e.Value));
gvDetail.SetFocusedRowCellValue(tb_PlanUnitVDtl.WorkTypeName, o);
}
else if (e.Column == colD_GroupID)//班组
{
object o = repGroup.GetDataSourceValue("GroupName", repGroup.GetDataSourceRowIndex("GroupID", e.Value));
gvDetail.SetFocusedRowCellValue(tb_PlanUnitVDtl.GroupName, o);
}
}
}