I'm trying to access a <li>
tag in my first master page file. I tried FindControl(..) but it allways returns null.
Structure:
<li id="element" runat="server"
>What do I need to do to access the li element?
You would usually access a server-side control like so:
Page.Master.FindControl("controlID");
However, if your tag is not set to runat="server"
, you'll have to find it another way, such as getting the resulting Response.Content and changing it at some point.
EDIT: Since you're using nested master pages, you may need to go further back in the control hierarchy if you want to reach the "root" master and find a control in it.
Maybe: Control li = Page.Master.Master.FindControl("controlID")