views:

392

answers:

2

I have a Intranet page that has a Site.map driven ASP Menu control that drives the entire site.

For most of my pages pushing the user to a new content page within the current window is great.

However for certain large reports there is simply not enough real estate to comfortably display the entire page.

Is it possible when clicking certain nodes that a new or "pop up" window appears ideally giving me the option to select the size.

Example code for site map file

<siteMap>
  <siteMapNode title="Top" >
    <siteMapNode title="Menu 1" >
      <siteMapNode title="Report" url="~/Iwantthisurl-to-pop-out.aspx"/>
    </siteMapNode>
  </siteMapNode>
</siteMap>

Edit,

After following the url Here in the comments I am much closer. However I am getting an error.

Protected Sub Menu1_MenuItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs)


    Dim address As String = String.Empty
    Dim heigth As String = String.Empty
    Dim width As String = String.Empty
    Dim title As String = String.Empty
    Dim url As String = String.Empty
    Dim poptest As String = String.Empty

    poptest = CStr(DataBinder.Eval(e.Item.DataItem, "url"))


    If String.IsNullOrEmpty(poptest) Then

        address = CStr(DataBinder.Eval(e.Item.DataItem, "address"))
        heigth = CStr(DataBinder.Eval(e.Item.DataItem, "heigth"))
        width = CStr(DataBinder.Eval(e.Item.DataItem, "width"))
        title = CStr(DataBinder.Eval(e.Item.DataItem, "title"))
        url = CStr(DataBinder.Eval(e.Item.DataItem, "url"))
    Else

    End If

For some reason it is only binding the standard sitemap attirbuites (title , url etc) and errors (DataBinding: 'System.Web.SiteMapNode' does not contain a property with the name 'address') when putting a breakpoint in I can read the standard attributes its the custom ones that done seem to be getting passed

So frustrating as I am so close!!

Edit 2 :

Found a way to open another window by using the _blank command but does not give me the ability to talior the window size and remove address bars etc. If anyone can get the example of the linked page to work I would love to see an example!

Edit 3 :

Convinced its something to do with these lines

title = ((SiteMapNode)(e.Item.DataItem))["title"];

should it not be

title = ((System.Web.SiteMapNode)(e.Item.DataItem)).Title;

when using this however for non standard sitemap parameters (address, height etc) it throws errors?

+2  A: 

Hi,

if you're using javascript you can use something like

function popup()
{
       var url = '/thepagetopopup.aspx';
       window.showModalDialog(url, 'Value', 'dialogHeight:600px,dialogWidth:1000px;');
       //or
       window.open(url, 'value', 'dialogHeight:600px,dialogWidth:800px');
       return false;
}

then call the function on your asp control.

hope this helps

Kamal
Not massively familiar with Java, where would I add this? To the Web.sitemap file?
David A
Can you post some code? this isn't java. it's javascript. which is a client side scripting language for web pages.
Kamal
Have a look at this. it's pretty basic.http://coloboxp.wordpress.com/2007/09/14/adding-javascript-to-aspnet-menu-control-to-open-a-popup-window-centered/
Kamal
A: 

I think you can do it without javascript, in your sitemap page add an attibute named target in to each node ( set to _blank if want pop up), and in your master sitemap template just do the following

<asp:SiteMapPath ID="SiteMapPath1" runat="server">
  <RootNodeTemplate>
<a href='#Eval("url")' target="_blank"><%# Eval("title") %></a>
     <asp:LinkButton ID="LinkButton1" runat="server" 
                     Text='<%# Eval("title") %>' 
                     CommandArgument='<%# Eval("url") %>' 
target='<%# Eval("target") %>' 
                     OnCommand="LinkButton1_Command">
     </asp:LinkButton>
  </RootNodeTemplate>
</asp:SiteMapPath>
tuanvt