J
João Maia
Hi there,
I am having a weird problem in trying to use a ASP.NET menu inside a
custom web part. I am developing a custom web part that has a menu
inside (just the menu, nothing else). The menu is a
System.Web.UI.WebControls.Menu (ASP.NET 2.0) object. If I add the menu
to a simple ASPX web form, it works nice. However, I am adding it to
my web part, by overriding the RenderWebPart method and doing
something like:
theMenu.renderControl(writer) //writer is the HTMLTextWriter
parameter of the RenderWebPart method
There are two problems when the menu is displayed on the webpart
(after this webpart is deployed to a Sharepoint Site):
- When the page loads, the menu structure is always fully expanded
(menus, submenus, etc), even though I have set the StaticDisplayLevels
property to 1. It then collapses but only when I hover with the mouse
pointer over each top level Menu Item.
- Whenever I pass with the mouse over each menu item, if it has
dynamic submenus, they get displayed but in the wrong place. What's
more, I see a "phantom DIV", more or less with the same size as the
submenu that should be displayed, but that DIV and the menu items
appear in different places on the page !!
I have not messed up with the menu's CSS style sheets, nor set any
other property other than the Orientation property to Horizontal (in
vertical it's weird as well). I suspect it has something to do with
the page structure that Sharepoint renders to the browser. Since that
structure is full of DIV tags, and the menu also has some DIV tags
when it renders to the client, I suspect that the browser is getting
"lost" in where to position the DIVs of each submenu and ends up
placing them in the wrong places. As I said, outside the sharepoint
and webpart environment (in a plain simple asp.net page it works
fine).
Has anyone had any similar problems ? I am getting totally lost here
and really could use some help...
Thanks,
Joao Maia
I am having a weird problem in trying to use a ASP.NET menu inside a
custom web part. I am developing a custom web part that has a menu
inside (just the menu, nothing else). The menu is a
System.Web.UI.WebControls.Menu (ASP.NET 2.0) object. If I add the menu
to a simple ASPX web form, it works nice. However, I am adding it to
my web part, by overriding the RenderWebPart method and doing
something like:
theMenu.renderControl(writer) //writer is the HTMLTextWriter
parameter of the RenderWebPart method
There are two problems when the menu is displayed on the webpart
(after this webpart is deployed to a Sharepoint Site):
- When the page loads, the menu structure is always fully expanded
(menus, submenus, etc), even though I have set the StaticDisplayLevels
property to 1. It then collapses but only when I hover with the mouse
pointer over each top level Menu Item.
- Whenever I pass with the mouse over each menu item, if it has
dynamic submenus, they get displayed but in the wrong place. What's
more, I see a "phantom DIV", more or less with the same size as the
submenu that should be displayed, but that DIV and the menu items
appear in different places on the page !!
I have not messed up with the menu's CSS style sheets, nor set any
other property other than the Orientation property to Horizontal (in
vertical it's weird as well). I suspect it has something to do with
the page structure that Sharepoint renders to the browser. Since that
structure is full of DIV tags, and the menu also has some DIV tags
when it renders to the client, I suspect that the browser is getting
"lost" in where to position the DIVs of each submenu and ends up
placing them in the wrong places. As I said, outside the sharepoint
and webpart environment (in a plain simple asp.net page it works
fine).
Has anyone had any similar problems ? I am getting totally lost here
and really could use some help...
Thanks,
Joao Maia