ASP.NET 2.0 Menu control targets and selecting

M

m_hansford

I have a Menu control that populates from a SiteMap file. It's on my
Master Page and usually loads content pages.

I've got 2 problems at the moment:

- Some of my menu items point to an external web site or to a PDF
document instead of just loading the next internal page. I want these
external links to open in a new browser window while retaining the
default target of _self. How can I do this? The only stuff I've seen so
far is based around using <menuItem>s.

- My parent menus are selectable and trigger a postback. I don't want
them to do this. i just want my leaf nodes to be selectable. I think
this might have something to do with using templates but the info I've
found is vague and doesn't apply to menus populated by SiteMap files.

I also can't find much by way of a reference for writing templates.

Thanks
Mike
 
G

Guest

Mike,
I have the same questions you have. I have searched the web for answers to
these questions to no avail. I have been using a third party menu control
from APNSoft which is capable of doing this. I would have thought that if
Microsoft was going to include a nice configurable menu control in ASP.Net
2.0 they would have included the ability to control the target of the
individual menu items. I am trying to use the control with a SQL sitemap
provider and I cannot even include a link to an external site. I have seen
one "workaround" for that which involves loading a bogus menu item and then
modifying it at some point during loading of the page. This does not seem to
be a desirable way to get around this seeming deficiency to me. If you have
found the solution to these problems, please post them here.
Thanks
 
Joined
Jan 15, 2008
Messages
1
Reaction score
0
solution

Code:
protected void Menu1_DataBound(object sender, EventArgs e)
    {
        for (int i = 0; i < this.Menu1.Items.Count; i++)
        {
            
                Menu1.Items[i].Selectable = false;
            
        }
    }
This allowed me to make the parent nodes unselectable while leaving the childern selectable.
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top