Posted on: 3/19/2015 1:09:47 AM | Views : 595

I am trying to access an anchor tag from the code behind but I am getting that my anchor tag is null
<ul id="recipeCategoriesUl"> <li><a id="Coctails" href="AllRecipes.aspx?Category=Coctails">Coctails</a></li> <li><a id="Dessert" href="AllRecipes.aspx?Category=Dessert">Dessert</a></li> <li><a id="Soups" href="AllRecipes.aspx?Category=Soups">Soups</a></li> <li><a id="Vegan" href="AllRecipes.aspx?Category=Vegan">Vegan</a></li> </ul> System.Web.UI.HtmlControls.HtmlAnchor currentCategoryAnchor = (System.Web.UI.HtmlControls.HtmlAnchor)recipeCategoriesUl.FindControl("Coctails"); currentCategoryAnchor.Attributes.Add("class", "Test");

Go to the complete details ...