I've got a dynamic navigation, when they user clicks on a different page, that tab needs to become the active tab. Currently I'm getting NullException error and an Object error.
FYI: That data is coming back fine, it's only when I try to change the tab to active it's not finding the ID.
webguy07
Participant
952 Points
234 Posts
Object Error with HtmlGenericControl
Apr 16, 2012 09:32 PM|LINK
I've got a dynamic navigation, when they user clicks on a different page, that tab needs to become the active tab. Currently I'm getting NullException error and an Object error. FYI: That data is coming back fine, it's only when I try to change the tab to active it's not finding the ID.
******* Navigation Control *******
****** Navigation Code ********
List<Navigation> theNavigation = DataHelper.GetNavigation(); theNavigation = theNavigation.OrderBy(u => u.OrderBy).ToList(); foreach (Navigation item in theNavigation) { ltl_Navigation.Text += "<li ID=" + '"' + item.TabName + '"' + " style=" + '"' + "display:" + item.Display + '"' + " class=" + '"' + item.Class + '"' + " runat=" + '"' + "server" + '"' + "><span><span><a href=" + '"' + item.Location + '"' + ">" + item.Title + "</a></span></span></li>"; }******* Default Page ***** "setting the active tab"
HtmlGenericControl li_active = (HtmlGenericControl)Page.Master.FindControl("tab_homeactive"); HtmlGenericControl li_inactive = (HtmlGenericControl)Page.Master.FindControl("tab_homeinactive"); li_active.Style["display"] = string.Empty; "This is where it's erroring out!!" li_inactive.Style["display"] = "none";