C# FindControl在GridView中不工作
void GridView1_RowCreated(对象发送方,GridViewRowEventArgs e) { 我无法让那个代码示例工作。 我需要访问页面上的超链接控件C# FindControl在GridView中不工作,c#,asp.net,C#,Asp.net,void GridView1_RowCreated(对象发送方,GridViewRowEventArgs e) { 我无法让那个代码示例工作。 我需要访问页面上的超链接控件 我有母版页设置。请确保您使用的模板字段包含ID为=“linkDocs”的超链接 OnRowDataBound事件可能更适合您的需要。此超链接控件是在gridview行中,还是在页面本身的其他位置? if (e.Row.RowType == DataControlRowType.DataRow) {
我有母版页设置。请确保您使用的模板字段包含ID为=“linkDocs”的超链接
OnRowDataBound事件可能更适合您的需要。此超链接控件是在gridview行中,还是在页面本身的其他位置?
if (e.Row.RowType == DataControlRowType.DataRow)
{
(e.Row.FindControl("linkDocs") as HyperLink).Visible = false;
}
}