0

当我单击在网格视图中手动添加的编辑按钮时,我需要替换网格视图中的标签。

请看下面的代码:

protected void btnchange_Click(object sender, EventArgs e)
{
    Button btn = (Button)sender;
    GridViewRow gvr = (GridViewRow)btn.NamingContainer;
    int getindex = gvr.RowIndex;
    gvorderdetail.Rows[getindex].Cells[3].Style.Value = "red";
    gvorderdetail.Rows[getindex].Cells[0].Attributes["style"] = "background-color:Red";
    gvorderdetail.Rows[getindex].Cells[1].Attributes["style"] = "background-color:Red";
    gvorderdetail.Rows[getindex].Cells[2].Attributes["style"] = "background-color:Red";
    TextBox tbx = (TextBox)gvorderdetail.Rows[getindex].FindControl("txtitemqty");
}


protected void gvorderdetail_RowCommand(object sender, GridViewCommandEventArgs e)
{
    if (e.CommandName == "change")
    {
        TextBox tbx = (TextBox)gvorderdetail.Rows[0].FindControl("txtitemqty");
    }
}

任何人都可以帮忙吗?

'>'>

4

0 回答 0