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[i];
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;
}
"DWS" <DW*@discussions.microsoft.com> a écrit dans le message de news:
00**********************************@microsoft.com...
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
"WT" wrote:
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