的FindControl不GridView的工作

问题描述:

无效GridView1_RowCreated(对象发件人,GridViewRowEventArgs E) {的FindControl不GridView的工作

if (e.Row.RowType == DataControlRowType.DataRow) 
    { 
     (e.Row.FindControl("linkDocs") as HyperLink).Visible = false; 


    } 

} 

我不能得到该代码示例工作。 我需要访问我的页面上的超链接控件。

我有一个母版页设置。

+0

这是超链接控件在gridview行或页面本身的其他地方? – patmortech 2010-07-17 13:09:05

确保您使用包含ID =“linkDocs”的超链接的TemplateField。

也许OnRowDataBound事件更适合您的需求。