当我点击gridview中手动添加的编辑按钮时,如何用文本框替换gridview中的标签?

时间:2013-09-24 09:27:19

标签: c# asp.net gridview

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

请参阅下面的代码:

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");
    }
}

有人可以帮忙吗?

  

               “>                                        “>            

0 个答案:

没有答案