Problems with .NET 2 Menu

W

WT

I use Menu navigation control in an ascx, the Menu if filled with Menuitems
during Load event.
Sub-MenuItems are added to the ChildItems collection.

But on the display the behavior of menu is not working: everything is
written in the same column, without any level considerations.
When I move mouse on dynamics elements, they disappear and never come back.

Is there a problem using Menu in ascx, is there a conflict in javascript.
Is it a known problem ?

Any help welcome.

CS
 
G

Guest

There are no problems with using menu in ascx. Infact its very easy to cache
it for performance that way. Youre almost there you need a minor mod to your
code thats it.

Create one initial menuitem, to your initial menuitem add the child
menuitems, add your initial menuitem to the menu.

Good Luck
DWS
 
W

WT

That's exactly what I am doing ????
Here is my code, whre is the problem ?

private void LoadControl(object sender, EventArgs e) {
if (!Page.IsPostBack)
InitData();
}

protected void InitData() {
// Build list of tabs to be shown to user
List<PageStripDetails> authorizedTabs = GetInnerDataSource();
for (int i = 0; i < authorizedTabs.Count; i++)
{
PageStripDetails myPage = (PageStripDetails) authorizedTabs;
AddMenuItem(myPage,0);
}
}

protected virtual void AddMenuItem(PageStripDetails myPage,int level) {
if (PortalSecurity.IsInRoles(myPage.AuthorizedRoles))
{
MenuItem mn = new MenuItem(myPage.PageName, myPage.PageID.ToString());
mn = RecurseMenu(myPage.Pages, mn,level+1);
if (mn.ChildItems.Count == 0)
mn.NavigateUrl = giveMeUrl(myPage.PageName, myPage.PageID);
else mn.Selectable = false;
this.Items.Add(mn);
}
}

protected virtual MenuItem RecurseMenu(List<PageStripDetails> t, MenuItem
mn,int level) {
if (t.Count > 0)
{
for (int c=0; c < t.Count; c++)
{
PageStripDetails mySubTab = t[c];
if (PortalSecurity.IsInRoles(mySubTab.AuthorizedRoles))
{
MenuItem mnc = new MenuItem(mySubTab.PageName, mySubTab.PageID.ToString());
mnc = RecurseMenu(mySubTab.Pages, mnc,level+1);
if (mn.ChildItems.Count == 0)
mnc.NavigateUrl = giveMeUrl(mySubTab.PageName, mySubTab.PageID);
else mnc.Selectable = false;
mn.ChildItems.Add(mnc);
}
}
}
return mn;
}
 
W

WT

Solution found.
My Page was using an override for Render(writer) and something was missing,
When calling the base.render everything is Ok for Menu.
Now problem is What is doing Page.Render thta was missing in myè override.

CS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top