Hello guys,
I am having an another issue with this web application I am making.
Unfortunately I can't understand why it is doing this.
HTML CODE
<nav id="mobileonly" class="clearfix" runat="server">
<asp:Panel ID="mobileMenuP" runat="server"></asp:Panel>
<a href="#" id="pull">Menu</a>
</nav>
<div class="content">
<div class="header">
<asp:Panel CssClass="pure-menu pure-menu-open pure-menu-fixed pure-menu-horizontal" ID="headerMenu" runat="server">
<div style="float: right; padding-removed 9px;" class="pure-form">
<fieldset>
<asp:TextBox runat="server" ID="user_email" placeholder="Email" TextMode="Email" ></asp:TextBox>
<asp:TextBox runat="server" ID="user_password" placeholder="Password" TextMode="Password" ></asp:TextBox>
<asp:Button runat="server" Text="Sign in" ID="login_button" OnClick="login_button_Click" CssClass="pure-button pure-button-primary" />
</fieldset>
</div>
</asp:Panel>
</div>
</div>
C# CODE
List<HtmlGenericControl> parents = new List<HtmlGenericControl>();
HtmlGenericControl[] parentsArr = parents.ToArray();
HtmlGenericControl mainMenuMenu = new HtmlGenericControl("ul");
for (int i = 0; i < parentsArr.Length; i++)
{
mainMenuMenu.Controls.Add(parentsArr[i]);
}
HtmlGenericControl mobileMenuMenu = mainMenuMenu;
mobileMenuMenu.Attributes.Add("class", "clearfix");
headerMenu.Controls.AddAt(0, mainMenuMenu);
mobileonly.Controls.AddAt(0, mobileMenuMenu);
Now the problem I am having is that if I comment this line of code
mobileonly.Controls.AddAt(0, mobileMenuMenu);
The headerMenu has no issue displaying the menu.
But when I un-comment it, all that is displayed in the headerMenu is
and mobileonly has a menu displayed no problem.
How the thing I don't understand is there isn't an error being thrown, the first isn't displaying anything but the second is which is backwards to programming logic.
Any ideas would be awesome.
Thanks