master page control on content page
- by kawade
I have got the following code on master page:
<u1>
...............
............
.............
</u1>
<ul>
<li id="link1" runat="server"><a href="mytestfile.aspx">Test Files</a></li>
<li id="link2" runat="server"><a href="mylistitemtest.aspx">List Item Test</a></li>
<li id="link3" runat="server"><a href="Mytest2.aspx">Some Test</a></li>
</ul>
I am trying to access the link1 on the content page as:
var pageHandler = HttpContext.Current.CurrentHandler;
if (pageHandler is System.Web.UI.Page)
{
((System.Web.UI.Page)pageHandler).Master.FindControl("nav_link1").Visible = false;
}
but i am getting the error as:
"Object reference not set to instance of an object"