Problems using NavigateUrl

3 posts, 0 answers
  1. Julio Loizaga
    Julio Loizaga avatar
    3 posts
    Member since:
    Dec 2009

    Posted 16 Nov 2010 Link to this post

    Hi. Sorry, I'm just a bit nerd using this controls.
     What I'm trying to do is quite simple: I want to display  treeview with some nodes linked to PDF files. Whe you click on that node, I want the PDF to open in a new Window. I populate the tree with data from a Database using  the Adjacency List Model. In the event RadTreeView1_NodeDataBound, I set the NavigateUrl property of the node this way:

    e.Node.NavigateUrl = "javascript:window.open('" + PDFpath + "')"

    where PDFpath is a valid URL to the PDF I want to show in a new window. It work's fine (the PDF is opened in a new window), but the treeView displayed on the main page vanished, and show the word : "[object]". What I'm doing wrong?.

    The code I'm using on the ASP page is quite simple, as you can see:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestWeb._Default" %>
    <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title></title>
        <style type="text/css">
            .style1
            {
                width: 100%;
            }
            .style2
            {
                width: 271px;
            }
        </style>
         
    </head>
    <body>
     
        <form id="form1" runat="server">
       <%-- <telerik:RadFormDecorator ID="RadFormDecorator1" Runat="server" DecoratedControls="Fieldset" />--%>
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <div>
        <table class="style1">
            <tr><td colspan ="2">
                    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="llenar TreeView" />
                 <asp:Button ID="Button2" runat="server" onclick="Button2_Click"Text="Expediente 1" />
                </td>
              
            </tr>
             
            <tr>
                    <td class="style2" valign="top">
         
            <fieldset >
            
                <telerik:RadTreeView ID="RadTreeView1" Runat="server"
                    LoadingMessage="Cargando ..." Skin="Outlook"
                    onnodedatabound="RadTreeView1_NodeDataBound" />
                 
            </fieldset>
                    </td>
                    <td>
                        <asp:GridView ID="GridView1" runat="server">
                        </asp:GridView>
                    </td>
                </tr>
            </table>
         
        </div>
        </form>
    </body>
    </html>

    Thank's in advance
  2. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 16 Nov 2010 Link to this post

    Hello Julio Loizaga,

    Could you, please, try the following:
     - set the navigate url without the "javascript:window.open" part, just the clean url. Then set a target attribute to the link element of the node with the value of "_blank".

    Please, let me know the results.
    I hope this will solve it for you!


    Regards,
    Nikolay Tsenkov
    the Telerik team
    Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. Julio Loizaga
    Julio Loizaga avatar
    3 posts
    Member since:
    Dec 2009

    Posted 17 Nov 2010 Link to this post

    Thank you!. It works properly this time... I didn't see the Target property.

    Best regards...
Back to Top