I am facing a challenge while building an ASP.Net 4.5 menu programmatically in C#. The main issue is that the formatting of the child items is not inheriting from the top menu items as expected. Specifically, I am struggling with two formatting aspects: StaticEnableDefaultPopOutImage and ItemSpacing. The former controls whether a little arrow shows up next to the MenuItem, and the latter determines the spacing between items. While the StaticEnableDefaultPopOutImage is set to false for the top menu items and works correctly, it fails to apply to the child items (resulting in the arrow showing up). Similarly, the ItemSpacing is set to 75px for the top menu items but does not space out the child items properly. The structure of the menu is defined in a Master Page. Here is an example of the menu code in the Master:
<asp:Menu runat="server" CssClass="bgcell_top_nav" ID="menuMain" Orientation="Horizontal" RenderingMode="Table" StaticEnableDefaultPopOutImage="false" Width="100%" ItemWrap="false" Height="250" DynamicVerticalOffset="8" StaticDisplayLevels="1">
<StaticMenuItemStyle ItemSpacing="75px" />
</asp:Menu>
Here's a snippet of the code behind:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//top menu items
MenuItem ApplicationFunctionality = new MenuItem();
ApplicationFunctionality.Text = "Applications";
ApplicationFunctionality.SeparatorImageUrl = "~/images/menu-pipe.png";
this.menuMain.Items.Add(ApplicationFunctionality);
MenuItem DatabaseFunctionality = new MenuItem();
DatabaseFunctionality.Text = "Databases";
DatabaseFunctionality.SeparatorImageUrl = "~/images/menu-pipe.png";
this.menuMain.Items.Add(DatabaseFunctionality);
//sub menu items
MenuItem Application_Add = new MenuItem();
Application_Add.Text = "Add";
ApplicationFunctionality.ChildItems.Add(Application_Add);
MenuItem Application_Search = new MenuItem();
Application_Search.Text = "Search";
ApplicationFunctionality.ChildItems.Add(Application_Search);
MenuItem Application_Reports = new MenuItem();
Application_Reports.Text = "Reports";
ApplicationFunctionality.ChildItems.Add(Application_Reports);
MenuItem CreateInternalApplication = new MenuItem();
CreateInternalApplication.Text = "Internal";
CreateInternalApplication.NavigateUrl = "~/TemplateForms/ApplicationCreationTemplateForm.aspx";
Application_Add.ChildItems.Add(CreateInternalApplication);
MenuItem CreateExternalApplication = new MenuItem();
CreateExternalApplication.Text = "External";
Application_Add.ChildItems.Add(CreateExternalApplication);
}
}
I have also attached a screenshot for reference: [Screenshot Link](https://i.sstatic.net/o32dt.png)
Any suggestions on how to properly format the child items in the menu would be greatly appreciated.