Asp.net GridView控件
我有一个网格控件。我想从其他控件访问gridview子控件 例:Asp.net GridView控件,asp.net,gridview,Asp.net,Gridview,我有一个网格控件。我想从其他控件访问gridview子控件 例: ... ........... ........... 但我有一个错误:“ddeAmirList”的TargetControlID无效。找不到ID为“lblAmirList”的控件 如何从其他控件访问grid view子控件?您必须在GridView控件中放置扩展程序,以便在控件的模板中工作。使用GridView的ondatabound 通过编写以下内容,可以访问gridview中的控件: protected void You
...
...........
...........
但我有一个错误:“ddeAmirList”的TargetControlID无效。找不到ID为“lblAmirList”的控件
如何从其他控件访问grid view子控件?您必须在GridView控件中放置扩展程序,以便在控件的模板中工作。使用GridView的ondatabound 通过编写以下内容,可以访问gridview中的控件:
protected void YourGridView_DataBound(object sender, EventArgs e)
{
Label label1 = (Label)e.Row.Cells[0].FindControl("lblAmirList");
// access your control
label1.Text = "sdfs";
// do this for other controls inside gridview
}
protected void YourGridView_DataBound(object sender, EventArgs e)
{
Label label1 = (Label)e.Row.Cells[0].FindControl("lblAmirList");
// access your control
label1.Text = "sdfs";
// do this for other controls inside gridview
}