首页 > 解决方案 > 我创建了网格,其中每一行都有用于批准请求的按钮..单击按钮时,该特定行的单元格值必须更改

问题描述

使用 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.  
    }    

 

标签: winformsdevexpress

解决方案


到目前为止,我已经在按钮单击事件处理程序中编写了,但它没有保存到数据库中。

私人无效btn_Approve_ButtonClick(对象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();

}


推荐阅读