This is a migrated thread and some comments may be shown as answers.

NavigateUrl and Target settings appear broken

5 Answers 224 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Chris Williams
Top achievements
Rank 1
Chris Williams asked on 20 Dec 2007, 07:41 PM
In the legacy TreeView, you could set the NavigateUrl and Target properties on a Node.  When used in conjunction with the RadSplitter, you could load content into a specific RadPane by using these settings on a Node  This appears to be broken in the just-released Q3 version.

For example, in this example, when you click on one of the TreeViewNodes, the entire page gets replaced by the NavigateURL setting.  You would expect that the content gets directed into the Content pane.

<

telerik:RadSplitter ID="RadSplitter1" runat="server" Orientation="Vertical" Width="700" Height="500">

<telerik:RadPane ID="Tree" runat="server" Width="30%">

<telerik:RadTreeView ID="RadTreeView1" runat="server">

<Nodes>

<telerik:RadTreeNode runat="server" Target="Content" Text="MSDN" NavigateUrl="http://msdn.microsoft.com"></telerik:RadTreeNode>

<telerik:RadTreeNode runat="server" NavigateUrl="http://www.google.com" Target="Content"

Text="Google">

</telerik:RadTreeNode>

</Nodes>

</telerik:RadTreeView>

</telerik:RadPane>

<telerik:RadSplitBar runat="server" />

<telerik:RadPane ID="Content" runat="server" ContentUrl="about:blank" Width="70%">

</telerik:RadPane>

</telerik:RadSplitter>

I'll open a case.

5 Answers, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 21 Dec 2007, 09:06 AM
Hello Chris,

Actually, we admit it's a bug in the control. I have reported it to our dev team and they will fix it ASAP. Meanwhile you can set the target attribute for the nodes in code behind. Here's a sample code snippet that show the approach.

ASPX:
<form id="form1" runat="server">  
    <asp:ScriptManager ID="ScriptManager1" runat="server">  
    </asp:ScriptManager> 
    <telerik:RadSplitter ID="RadSplitter1" runat="server" Orientation="Vertical" Width="700" Height="500">  
        <telerik:RadPane ID="Tree" runat="server" Width="30%">  
            <telerik:RadTreeView ID="RadTreeView1" runat="server">  
                <Nodes> 
                    <telerik:RadTreeNode runat="server" Text="MSDN" NavigateUrl="http://msdn.microsoft.com">  
                    </telerik:RadTreeNode> 
                    <telerik:RadTreeNode runat="server" Text="Google" NavigateUrl="http://www.google.com">  
                    </telerik:RadTreeNode> 
                </Nodes> 
            </telerik:RadTreeView> 
        </telerik:RadPane> 
        <telerik:RadSplitBar ID="RadSplitBar1" runat="server" /> 
        <telerik:RadPane ID="Content123" runat="server" Width="70%" ContentUrl="about:blank">  
        </telerik:RadPane> 
    </telerik:RadSplitter> 
</form> 

Code-behind:
protected void Page_Load(object sender, EventArgs e)  
{  
    foreach (RadTreeNode myNodes in RadTreeView1.GetAllNodes())  
    {  
        myNodes.Attributes["target"] = "Content123";  
    }  

All the best,
Paul
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
ashalan
Top achievements
Rank 1
answered on 30 Dec 2007, 03:48 PM
Setting the .Target attribute in code behind when using Load On Demand has no effect either.

Using .Attributes["target"], however, works just fine.
0
Mark
Top achievements
Rank 1
answered on 17 Feb 2011, 05:10 PM
Hi,

I know this is an old thread, but I'm having the same problem with RadControls for ASP.NET AJAX Q3 2010 Net35. 

Here is my aspx page:

<telerik:radsplitter id="RadSplitter1" runat="server" height="100%" width="100%">
                <telerik:RadPane runat="server" ID="RadPane1" Width="30%" BackColor="#F2F3F7">
                    <h3>Contents</h3>
                    <telerik:RadTreeView ID="RadTreeView1" runat="server" Skin="Office2007"
                        CollapseAnimation-Type="Linear" CollapseAnimation-Duration="800"
                        ExpandAnimation-Type="Linear" ExpandAnimation-Duration="800"
                        OnNodeExpand="RadTreeView1_NodeExpand">
                    </telerik:RadTreeView>
                </telerik:RadPane>
                <telerik:RadSplitBar runat="server" ID="RadSplitbar1" CollapseMode="Forward" />
                <telerik:RadPane runat="server" ID="Radpane2" Width="70%">
                    Right Pane
                </telerik:RadPane>
            </telerik:radsplitter>

and here is my code-behind that loads the treeview control:

foreach (string file in files)
{
   RadTreeNode node = new RadTreeNode(Path.GetFileName(file));
   node.NavigateUrl = virtualPath + "/" + Path.GetFileName(file);
   node.Attributes["target"] = Radpane2.ClientID;
   string extension = Path.GetExtension(file).ToLower().TrimStart('.');
   node.ImageUrl = "~/Images/html.png";
   parentNode.Nodes.Add(node);
}

Here's what I see when I view source:

<div class="rtBot  rtSelected">
    <span class="rtSp"></span><img src="http://localhost:3226/MSC3.0Prototype/Images/html.png" alt="" class="rtImg"><a class="rtIn" target="ctl00_ContentPlaceHolder1_Radpane2" href="Help/Topics/Support.htm">Support.htm</a>
</div>


When I click on the "Support.htm" in the treeview, the page loads, albeit in a new window. How can I get the .htm file to load in the right pane (RADPane2)?

Thanks,
Mark
0
Nikolay Tsenkov
Telerik team
answered on 21 Feb 2011, 01:52 PM
Hi Chris Williams,

Please, try setting the Target property of RadTreeNode (e.g. node.Target instead node["target"]) and let me know the results.


Regards,
Nikolay Tsenkov
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Mac P
Top achievements
Rank 1
answered on 12 May 2011, 04:12 AM

Target property only works on the treeview that is not in master page. For master page the clientid generated is appended by master id so it will open in popup.

Work around is

foreach (RadTreeNode myNodes in TreeView.GetAllNodes())
        {
            myNodes.Attributes["target"] = contentPane.ClientID;
        }
Tags
TreeView
Asked by
Chris Williams
Top achievements
Rank 1
Answers by
Paul
Telerik team
ashalan
Top achievements
Rank 1
Mark
Top achievements
Rank 1
Nikolay Tsenkov
Telerik team
Mac P
Top achievements
Rank 1
Share this question
or