/// <summary>
/// 编辑按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void dgv_mainkey_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
var dgv = (DataGridView)sender;
var currentRow = dgv.Rows[e.RowIndex];
var currentColumn = dgv.Columns[e.ColumnIndex];
if(currentColumn?.Name == "btnModify")
{
currentRow.ReadOnly = false;
}
//保存
if (currentColumn?.Name == "btnSave")
{
if(currentRow.DataBoundItem is PredictLimitConfigDto dto)
{
dto.MODIFIED_TIME = DateTime.Now;
ForecastCapacityBLL.SavePredictLimitConfig(dto);
}
}
}
【c#】获取DGV单元格对象方法&&dgv按钮列的使用介绍
最新推荐文章于 2023-04-29 16:58:55 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)