MasterPages - 动态创建的菜单消失 [英] MasterPages - Dynamically Created Menus Disappearing

查看:75
本文介绍了MasterPages - 动态创建的菜单消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在玩动态创建一些菜单

,并且他们

创建正常并且在我想要它们时显示正常;但是当我在运行时选择一个

菜单NavigateUrl时,

,适用的网址显示

up

预计在内容占位符但菜单

消失...


菜单是母版页的一部分,不在

内容持有人......


任何人都有任何想法吗?


我错过了一些明显的东西吗?


当我在设计时创建相同的菜单时它没有

表现出这种行为......


提前感谢。

解决方案

" LvBohemian" < Lv ******** @ discussion.microsoft.com写信息

news:29 ******************** ************** @ microsof t.com ...


菜单是母版页的一部分,不在

内容持有者...



这很好,但动态生成<的代码在哪里? br />
MenuItems集合......?


这是我绑定的方式,除了我打电话

CreateMenuItemBinding来自一个按钮的click事件,用于测试

目的......

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


正如我说的一切正常,所有菜单项都按预期显示,然后

当我选择一个菜单项加载适用的NavigateUrl到了

MasterPage ContentPlaceHolder我丢失了菜单,它消失了,虽然

NavagateUrl * .aspx出现在ContentPlaceHolder中,因为它应该......


如果我从

选择NavigateUrl之后可以看到菜单,我动态创建菜单并在MasterPage中显示NavigateUrl

ContentPlaceHolder ,然后我可以向前推进我的想法,我在踢...


提前谢谢。


" LvBohemian" < Lv ******** @ discussion.microsoft.com写信息

新闻:4A ******************** ************** @ microsof t.com ...


当我选择一个菜单项时,将适用的NavigateUrl加载到

MasterPage ContentPlaceHolder



我不知道你在这做什么...

一般来说,在MasterPage / ContentPage架构中,你没有通过菜单动态选择ContentPage - 而是简单地

导航到另一个ContentPage当它加载时,它会获取它的主页并将两个文件合并为一个HTML文档...


Eg如果您有Page1.aspx和Page2.aspx,两者都是ContentPages

并使用相同的MasterPage,您的MenuItem应该通过其NavigateUrl导航到

Page2.aspx属性 - 它当然不应该是

试图在

MasterPage上播放ContentPlaceHolder的内容......

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.

解决方案

"LvBohemian" <Lv********@discussions.microsoft.comwrote in message
news:29**********************************@microsof t.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...?


This is how I am binding, with the exception that I am calling
CreateMenuItemBinding 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 ContentPlaceHolder I lose the menu, it disappears, although the
NavagateUrl *.aspx appears in the ContentPlaceHolder 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
ContentPlaceHolder, then I can move forward with my idea that I am kicking
around...

Thanks in advance.


"LvBohemian" <Lv********@discussions.microsoft.comwrote in message
news:4A**********************************@microsof t.com...

when I select a menu item which loads the applicable NavigateUrl into the
MasterPage ContentPlaceHolder

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 ContentPlaceHolder on the
MasterPage...


这篇关于MasterPages - 动态创建的菜单消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆