DevExpress GridView 表格内嵌ButtonEdit按钮列图片按钮及Click事件
DevExpress GridView 表格内嵌ButtonEdit按钮列图片按钮及Click事件如下图所示,在表格中添加按钮列,并绑定Click事件。

在表格中添加列,ColumnEdit属性选择ButtonEdit, 改名:btnCustomerDetail。


.Designer.cs代码参考:
C# Code:
this.btnOrderDetail.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor;
//来源:C/S框架网 | www.csframework.com | QQ:23404761
this.btnOrderDetail.AutoHeight = false;
this.btnOrderDetail.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "", -1, true, true, false, DevExpress.XtraEditors.ImageLocation.MiddleCenter, ((System.Drawing.Image)(resources.GetObject("btnOrderDetail.Buttons"))), new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject2, "", null, null, true)});
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "", -1, true, true, false, DevExpress.XtraEditors.ImageLocation.MiddleCenter, ((System.Drawing.Image)(resources.GetObject("btnOrderDetail.Buttons"))), new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject2, "", null, null, true)});
this.btnOrderDetail.ButtonsStyle = DevExpress.XtraEditors.Controls.BorderStyles.HotFlat;
this.btnOrderDetail.Name = "btnOrderDetail";
this.btnOrderDetail.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor;
//来源:C/S框架网 | www.csframework.com | QQ:23404761
给btnCustomerDetail按钮绑定Click事件:
C# Code:
btnCustomerDetail.ButtonClick += BtnCustomerDetail_ButtonClick;
private void BtnCustomerDetail_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
{
if (gvSummary.FocusedRowHandle >= 0)
{
string cid = gvSummary.GetFocusedDataRow()["CustomerId"].ToStringEx();
frmCustomerDetailWebPage.ShowMe(frmMain.Instance, cid);
}
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761
private void BtnCustomerDetail_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
{
if (gvSummary.FocusedRowHandle >= 0)
{
string cid = gvSummary.GetFocusedDataRow()["CustomerId"].ToStringEx();
frmCustomerDetailWebPage.ShowMe(frmMain.Instance, cid);
}
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761

参考文档:
DevExpress GridView表格CustomUnboundColumnData事件异步加载图片
DevExpress GridView单元格CellValueChanged事件详解
踩坑日记 | DevExpress GridView.GetSelectedRows方法返回无效的RowHandle行号|C/S开发框架
修改单元格关联更新其它列的值,Dev GridView组件OnCellValueChanged事件实现
C# Dev GridView表格的CustomUnboundColumnData事件异步加载图片类AsynDownImage
DevExpress GridView表格记录位置调整,实现DataRow记录排序
表格GridView.CustomDrawEmptyForeground事件显示没有查询到数据
DevExpress GridView设置焦点行颜色
DevExpressV22:RepositoryItemComboBox的QueryPopUp事件无法动态加载数据项
C#.NET7 VS2022 使用反射动态设置按钮Click事件
解决方案:C# 当按钮不可见时(Visible=False),调用Button.PerformClick事件无效!
C#获取按钮的EventClick事件,EventHandlerList委托的调用列表
DevExpress GridView获取主从表,主子表,子级二层表的当前记录(Master/Detail)
DevExpress GridView在只读状态下如何隐藏表格的按钮EditorShowMode|ShowButtonMode
DevExpress GridView设置单元格网格线颜色|C/S框架网
解决:DevExpress.GridControl.GridView表格导出乱码
DevExpress GridView表格CustomUnboundColumnData事件异步加载图片
DevExpress GridView单元格CellValueChanged事件详解
踩坑日记 | DevExpress GridView.GetSelectedRows方法返回无效的RowHandle行号|C/S开发框架
修改单元格关联更新其它列的值,Dev GridView组件OnCellValueChanged事件实现
C# Dev GridView表格的CustomUnboundColumnData事件异步加载图片类AsynDownImage
DevExpress GridView表格记录位置调整,实现DataRow记录排序
表格GridView.CustomDrawEmptyForeground事件显示没有查询到数据
DevExpress GridView设置焦点行颜色
DevExpressV22:RepositoryItemComboBox的QueryPopUp事件无法动态加载数据项
C#.NET7 VS2022 使用反射动态设置按钮Click事件
解决方案:C# 当按钮不可见时(Visible=False),调用Button.PerformClick事件无效!
C#获取按钮的EventClick事件,EventHandlerList委托的调用列表
DevExpress GridView获取主从表,主子表,子级二层表的当前记录(Master/Detail)
DevExpress GridView在只读状态下如何隐藏表格的按钮EditorShowMode|ShowButtonMode
DevExpress GridView设置单元格网格线颜色|C/S框架网
解决:DevExpress.GridControl.GridView表格导出乱码
其它资料:
什么是C/S结构? | C/S框架核心组成部分 | C/S框架-WebService部署图 | C/S框架-权限管理 | C/S结构系统框架 - 5.1旗舰版介绍 | C/S结构系统框架 - 功能介绍 | C/S结构系统框架 - 产品列表 | C/S结构系统框架 - 应用展示(图) | 三层体系架构详解 | C/S架构轻量级快速开发框架 | C/S框架网客户案例 | WebApi快速开发框架 | C/S框架代码生成器 | 用户授权注册软件系统 | 版本自动升级软件 | 数据库底层应用框架 | CSFramework.CMS内容管理系统 |
什么是C/S结构? | C/S框架核心组成部分 | C/S框架-WebService部署图 | C/S框架-权限管理 | C/S结构系统框架 - 5.1旗舰版介绍 | C/S结构系统框架 - 功能介绍 | C/S结构系统框架 - 产品列表 | C/S结构系统框架 - 应用展示(图) | 三层体系架构详解 | C/S架构轻量级快速开发框架 | C/S框架网客户案例 | WebApi快速开发框架 | C/S框架代码生成器 | 用户授权注册软件系统 | 版本自动升级软件 | 数据库底层应用框架 | CSFramework.CMS内容管理系统 |
在线客服
