C# 当我单击gridview中手动添加的编辑按钮时,如何用文本框替换gridview中的标签?
当我单击在grid view中手动添加的编辑按钮时,我需要替换gridview中的标签 请参阅以下代码:C# 当我单击gridview中手动添加的编辑按钮时,如何用文本框替换gridview中的标签?,c#,asp.net,gridview,C#,Asp.net,Gridview,当我单击在grid view中手动添加的编辑按钮时,我需要替换gridview中的标签 请参阅以下代码: protected void btnchange_Click(object sender, EventArgs e) { Button btn = (Button)sender; GridViewRow gvr = (GridViewRow)btn.NamingContainer; int getindex = gvr.RowIndex; gvorderdet
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");
}
}
有人能帮忙吗
'>
'>
我不明白。你为什么要替换?如果你尝试了什么,会有什么问题?请告诉我们一些细节。你为什么不使用edittemplate或gridview,或者看看这里你想替换哪个标签?@shreyas:我想用文本框替换lblqty它不会用文本框替换标签。