Note that there are some explanatory texts on larger screens.

plurals
  1. POGenerate Menus programatically in Asp.net c# web form
    primarykey
    data
    text
    <p>I have to create dynamic menus from the database. I used the following example which only shows the parent menus but doesn't show the child menu. <a href="http://www.dotnetfunda.com/articles/article1477-how-to-create-a-menu-in-aspnet-using-aspmenu-control.aspx" rel="nofollow">http://www.dotnetfunda.com/articles/article1477-how-to-create-a-menu-in-aspnet-using-aspmenu-control.aspx</a></p> <p>Code snippet i am using</p> <pre><code>&lt;asp:Menu ID="Menu1" runat="server" Orientation="Horizontal" &gt; // I am convert ds to table for now. DataTable table = dsMenu.Tables[0]; ; DataView dvMenu = new DataView(table); dvMenu.RowFilter = "PageInheritance is NULL"; foreach (DataRowView row in dvMenu) { MenuItem menuItem = new MenuItem(row["PageName"].ToString(), row["PageId"].ToString()); menuItem.NavigateUrl = row["PageURL"].ToString() + "?PageId=" + row["PageId"] + "&amp;Language=" + sLangCode; Menu1.Items.Add(menuItem); AddChildItems(dvMenu.Table, menuItem); } //Function to look for child menu private static void AddChildItems(DataTable table, MenuItem menuItem) { DataView viewItem = new DataView(table); viewItem.RowFilter = "PageInheritance = " + menuItem.Value; foreach (DataRowView childView in viewItem) { MenuItem childItem = new MenuItem(childView["PageName"].ToString(), childView["PageId"].ToString()); childItem.NavigateUrl = childView["PageURL"].ToString(); menuItem.ChildItems.Add(childItem); AddChildItems(table, childItem); } } </code></pre> <p>I am not sure what i am doing wrong. Based on my database it should show me child menus for row xyz. when AddChildItems function is called for the match child row it just skill the loop and doesnt show any thing from teh child rows.</p> <p>OUTPUT with Current Code</p> <p>HOME | Page2 | Page3 | Page4</p> <p>It should show me sub menus for the Page2 based on my database. rather it only shows parent page links as above.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload