问题描述
使用Dev Express,Winform平台。 此处,仅在单击按钮时,UO_APR_STATUS列必须从R更改为A,但是按钮不会触发事件。请帮忙。
public frmUnitOff()
{
InitializeComponent();
BindingList<OM_UNIT_OFFER> result = new BindingList<OM_UNIT_OFFER>((from u in Program.projectModel.OM_UNIT_OFFERS orderby u.UO_SYS_ID where u.UO_APR_STS == "R" select u).ToList());
this.gridControl1.DataSource = result;
}
private void btn_Approve_ButtonClick(object senderDevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
{
//Write code for grid cell value update on button click.
}
解决方法
到目前为止,我已经在按钮单击事件处理程序中编写了内容,但是它没有保存到数据库中。
private void btn_Approve_ButtonClick(object senderDevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
{
gridView1.SetRowCellValue(gridView1.FocusedRowHandle,gridView1.Columns["UO_APR_STS"],"A");
var a = gridView1.GetFocusedRowCellValue("UO_SYS_ID");
double ab = double.Parse(a.ToString());
BindingList<OM_UNIT_OFFER> result = new BindingList<OM_UNIT_OFFER>((from u in Program.projectModel.OM_UNIT_OFFERS
orderby u.UO_SYS_ID
where u.UO_SYS_ID == ab
select u.UO_SYS_ID));
if (gridView1.PostEditor())
{
OM_UNIT_OFFER _unif = new OM_UNIT_OFFER();
_unif.UO_APR_STS = "A";
}
gridView1.ShowEditor();
}
,现在工作正常。我正在分享输出的代码可能对某人有帮助。感谢@brendon的关注。
{{1}}