遗忘海岸

江湖程序员 -Feiph(LM战士)

导航

SearchLookupEdit 选择后联动

直接改绑定数据源--实体的属性会导致选择内容变空 【将选中项清除时】

所有改相应控件的text属性然后再写入数据源

 

最好将需要联动的控件设置成只读


mNoTextEdit.EditValueChanged += (s, e) =>
{


mM_QuotationBindingSource.EndEdit();
var cur = mM_QuotationBindingSource.Current as MM_Quotation;
var mNo = mNoTextEdit.EditValue as String;
if (string.IsNullOrWhiteSpace(mNo)) return;
var mm = MMUtil.GetList().FirstOrDefault(ent => ent.p_partno == mNo);//到这里正常
if (mm != null)
{
specificationTextEdit.Text = Util.V(mm.p_othername1);
unitTextEdit.Text = Util.V(mm.p_unit);
mM_QuotationBindingSource.EndEdit();
}

};

 

对于gridveiw的下拉联动,貌似没有上面的问题

repositoryItemSearchLookUpEdit1.EditValueChanged += (s, e) =>
{
gridView1.CloseEditor();
items_BindingSource.EndEdit();
var cur = items_BindingSource.Current as PP_MMProcessUsed;
if (cur == null) return;

var q = UseBOMList.FirstOrDefault(ent => ent.MNo == cur.MNo);
if (q == null)
{
cur.Amount = 0;
cur.MName = "";
cur.MUnit = "";
}
else
{
cur.MName = q.MName;
cur.MUnit = q.MUnit;
cur.Amount = q.Amount;
}
items_BindingSource.ResetCurrentItem();
};

posted on 2019-12-04 15:53  遗忘海岸  阅读(455)  评论(0编辑  收藏  举报