如果 sVal 包含当前行的“字段名称”,我需要更新前一行的单元格 4 以添加按钮单击事件。
protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        string sVal = e.Row.Cells[2].Text;
        if (sVal.Contains("Field Name"))
        {
            // update cell[4] of previous row with button click event
            e.Row.Cells[2].BackColor = System.Drawing.Color.WhiteSmoke;
            e.Row.Cells[2].Font.Bold = true;
            e.Row.Cells[3].BackColor = System.Drawing.Color.WhiteSmoke;
            e.Row.Cells[3].Font.Bold = true;
            e.Row.Cells[4].BackColor = System.Drawing.Color.WhiteSmoke;
            e.Row.Cells[4].Font.Bold = true;
        }
    }