473,670 Members | 2,295 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MasterPages - Dynamically Created Menus Disappearing

I am playing around with creating some menus
dynamically, and they
create fine and show up ok when I want them to; but
when I select a
menu NavigateUrl at run time, the applicable url shows
up as
anticipated in the content place holder but the menu
disappears...

the menu is part of the master page and is not in the
content place holder...

anybody have any ideas?

am I missing something obvious?

when I create the same menu at design time it does not
exhibit this behavior...

thanks in advance.

Oct 23 '06 #1
23 12533
"LvBohemian " <Lv********@dis cussions.micros oft.comwrote in message
news:29******** *************** ***********@mic rosoft.com...
the menu is part of the master page and is not in the
content place holder...
That's good, but where is the code which does the dynamic generation of the
MenuItems collection...?
Oct 23 '06 #2
This is how I am binding, with the exception that I am calling
CreateMenuItemB inding from within the click event of a button for test
purposes...

http://msdn2.microsoft.com/en-us/lib...ollection.aspx

As I said everything works fine, all menu items show up as anticipated, then
when I select a menu item which loads the applicable NavigateUrl into the
MasterPage ContentPlaceHol der I lose the menu, it disappears, although the
NavagateUrl *.aspx appears in the ContentPlaceHol der as it should...

If I can get the menu to stick around after I select the NavigateUrl from
the menu I created dynamically and display the NavigateUrl in the MasterPage
ContentPlaceHol der, then I can move forward with my idea that I am kicking
around...

Thanks in advance.

Oct 23 '06 #3
"LvBohemian " <Lv********@dis cussions.micros oft.comwrote in message
news:4A******** *************** ***********@mic rosoft.com...
when I select a menu item which loads the applicable NavigateUrl into the
MasterPage ContentPlaceHol der
I'm not sure what you're doing here...

Generally speaking, in the MasterPage / ContentPage architecture, you do not
dynamically select the ContentPage through a menu - instead, you simply
navigate to another ContentPage which, when it loads, picks up its
MasterPage and merges the two files into one HTML document...

E.g. if you have Page1.aspx and Page2.aspx, both of which are ContentPages
and use the same MasterPage, your MenuItem should simply navigate to
Page2.aspx through its NavigateUrl property - it should certainly not be
trying to play about with the contents of the ContentPlaceHol der on the
MasterPage...
Oct 23 '06 #4
I hope this explains it better...

The master page that I am dynamically creating a menu on works fine...

I am trying to select the content page that I want to display on the same
master page; from the dynamic menu I created, much as you would do from a
TreeView control as is done on the MSDN page, it works as anticipated if I
create a static menu at design time; but using the same settings at runtime,
when I select a menu item it does display the content page as it is supposed
to but the menu disappears, even though it is part of the master page...
I want the menu to stick around in case I want to load a different content
page instead in the same MasterPage…

Thanks in advance.

Oct 23 '06 #5
"LvBohemian " <Lv********@dis cussions.micros oft.comwrote in message
news:AC******** *************** ***********@mic rosoft.com...
>I hope this explains it better...
I'm afraid it doesn't...
I want the menu to stick around in case I want to load a different content
page instead in the same MasterPage.
Still seems to me that you're doing this backwards...

Menus don't really work the same way as TreeViews...

To change the ContentPage, you simply navigate to the other ContentPage - it
will automatically pick up its MasterPage and redraw the menu for you...
Oct 23 '06 #6
I am navigating to the applicable content page, using the NavigateUrl that is
selected via the menu, when I do the menu disapears...
Oct 23 '06 #7
Dump a button on the masterpage and click on it..
Will the menu dissapear as well?
This is usually due not rebuilding the menu again on page load.

sorry if i'm way off here.

"LvBohemian " <Lv********@dis cussions.micros oft.comschreef in bericht
news:DF******** *************** ***********@mic rosoft.com...
>I am navigating to the applicable content page, using the NavigateUrl that
is
selected via the menu, when I do the menu disapears...

Oct 23 '06 #8
thats how I am testing it, when I click on the button on the master page, I
dynamically build a menu, and it looks and works like I want it to at that
point...
then when I select a menu item which is wired to NavigateUrl to display the
applicable content page in the same master page's content place holder, it
shows the content page but the menu disappears...

thanks in advance.

Oct 23 '06 #9
"LvBohemian " <Lv********@dis cussions.micros oft.comwrote in message
news:DF******** *************** ***********@mic rosoft.com...
>I am navigating to the applicable content page, using the NavigateUrl that
is
selected via the menu, when I do the menu disapears...
Ah well alright then - but that isn't, in fact what you actually said... You
said "...then when I select a menu item which loads the applicable
NavigateUrl into the MasterPage ContentPlaceHol der...", which is what I
thought you meant!

That's fine - you appear to be doing it correctly - you just have a problem
with nomenclature. Selecting a menu item doesn't load the applicable
NavigateUrl into the MasterPage ContentPlaceHol der - it's precisely the
reverse. Selecting a menu item navigates to the ContentPage which loads its
MasterPage.

However, that's by the by...

Back to the original question - where is the code which does the dynamic
menu creation...?
Oct 23 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1745
by: clintonG | last post by:
Does anybody know how to use a control such as the DropDownList to change Themes when using MasterPages? I'm also asking in the forum. <%= Clinton Gallagher METROmilwaukee (sm) "A Regional Information Service" NET csgallagher AT metromilwaukee.com URL http://metromilwaukee.com/ URL http://clintongallagher.metromilwaukee.com/
6
1759
by: Kenneth Keeley | last post by:
Hi, I have a Masterpage that controls the basic layout of the pages displayed on a web site. The masterpage also uses some variables. I would like to be able to access some of these variables from the content pages. Can this be done and if so how. I have made the Varibles that I wish to access Public Members. Thanks for any help. Kenneth
2
2459
by: iturner100 | last post by:
Hi, I've been struggling with this one for a couple of hours without much joy. Basically, I've got a set of nested masterpages (3 as it happens). I'm dynamically generating a new page in code and want to be able to populate the ContentPlaceholders of the inner-most masterpage at run-time.
6
1856
by: Tony Marston | last post by:
I have a site at http://www.radicore.org which has a menu bar down the left hand side. When certain menu items are selected (What is Radicore? Products, Documentation, Licensing, Legal) a sub-menu automatically appears. This works fine in FF and Opera, but in IE as soon as the "Legal" option, or any of its sub-menus, are selected, all the hyperlinks disappear from view as if the foreground and background colours have become the same....
6
1975
by: =?Utf-8?B?U3RlcGhlbiBIYXRmaWVsZA==?= | last post by:
I have two masterpages in a web application. One is used for the login and logout pages. The other is used for all other pages in the application. The difference between the two masterpages is that on the main one I have a user control in the left side that has the site navigation menu while the login/logout masterpage has a non-breaking space in that table cell. Everything else is exactly the same. The issue is that the login/logout...
6
1468
by: =?Utf-8?B?UGV0ZXJX?= | last post by:
I have 3 master pages. The second has a contents object that contains the horizontal menu, the third a contents object that contains the vertical menus and all WebForms use master3 as their Master Page. The content of any WebForms is below the horizontal menu and right of the left hand menu. My problem is that the menu structure is 5 layers deep in parts and the bits that need to be selected are actually over the WebForm content and...
1
1842
by: =?Utf-8?B?UGV0ZXJX?= | last post by:
I have 3 master pages. The second has a contents object that contains the horizontal menu, the third a contents object that contains the vertical menus and all WebForms use master3 as their Master Page. The content of any WebForms is below the horizontal menu and right of the left hand menu. My problem is that the menu structure is 5 layers deep in parts and the bits that need to be selected are actually over the WebForm content and...
0
1371
by: Syoam4ka | last post by:
My project is about jewellery. I have devided my jewelery into main types, which each one of them has sub types, and each one those sub types has the jewellery. I have a tabcontainer. It includes tabpanels such as:Catalog,Terms,SiteMap.ViewCart ,etc. All the jewellery Intro is in the Catalog panel. when I first click the Catalog panel it Introduces me all the main types of the jewellery(It's all done dynamically from the cs file).The...
7
1378
by: Malakie | last post by:
Hi all, I am trying to self teach VB .net to myself. Not sure what is worse, trying to accomplish this or thinking I can actually do it! ;-) Anyhow, Would someone be able to give me some example VB net code that would create buttons on a form dynamically for each drive (cd or HD or virtual etc) found on a system; labeling each created button with one of the found drive letters. It would also need to remove said button if the drive...
0
8471
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8388
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8907
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8817
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8663
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7423
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5687
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2804
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.