I have an HTML element <a> in my Site.Master in my webforms. I designed it like this:
<li>
<a runat="server" id="sbHome" href="Dashboard.aspx" class="dropdown-toggle no-arrow">
<span class="micon bi bi-house"></span><span class="mtext">Home</span>
</a>
</li>
I am trying to get the sbHome in my Dashboard to set it active on my code behind, like this.
HtmlGenericControl aControl = Master.FindControl("sbHome") as HtmlGenericControl;
if (aControl != null)
{
aControl.Attributes.Clear();
aControl.Attributes.Add("class", "dropdown-toggle no-arrow active");
}
yet, The Master.FindControl method returns null. How can I possibly get this element
from my content page?