winforms - 我创建了网格,其中每一行都有用于批准请求的按钮..单击按钮时,该特定行的单元格值必须更改
问题描述
使用 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.
}
解决方案
到目前为止,我已经在按钮单击事件处理程序中编写了,但它没有保存到数据库中。
私人无效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();
}
推荐阅读
- python - 安装后找不到覆盖python库
- arrays - 如何在逗号之间拆分字符串并使用vba将每个字符串存储在数组变量中
- java - 使用 Java 的平均计算器程序
- php - 有条件地删除 Woocommerce 中的订单详细信息部分
- swift - UITabBarController 中的测试方法正确设置标题
- c - 输入EOF时Shell无限循环C
- mysql - Bash:mysqlimport命令在没有提示的情况下写入数据库
- html - 如何根据子元素高度制作引导导航栏比例?
- python - 如果列值是数字,熊猫将一列中的值与另一列相乘?
- postgresql - 使用 docker-compose 时如何安全地停止/启动我的 postgres 服务器