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

[Solved] Can i put treeview into master page?

2 Answers 43 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Leon Ren
Top achievements
Rank 1
Leon Ren asked on 27 Apr 2010, 09:11 AM

Can i put treeview code into master page? i put the code below into Site.master page, but it didn't work. I can't expand tree node.


        <% Html.Telerik().TreeView()  
       .Name("TreeView")  
       .Items(items => 
       {  
           items.Add().Text("Item 1").Items(subItem=> 
               {  
                   subItem.Add().Text("subItem1").Url("http://www.google.com.") ;  
               });  
           items.Add().Text("Item 2").Url("http://www.baidu.com").HtmlAttributes(new { alt = "Baidu" });  
           items.Add().Text("Item 3");  
       })  
       .Render() ;   
        %> 

Is it possible to do this? i don't want to put these codes in each of view page and i am really breaking my head.

Hope someone can help me, thanks.

2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 27 Apr 2010, 04:19 PM
Hello Leon,

There should be no problem to place TreeView component into master page. I suppose that the treeview is rendered correctly and the required css styles are applied. Could you please verify that the ScriptRegistrar() component is placed on the page (it is responsible for registering the required javascript files)?
If it is added to the page, you can verify that the action name and controller name are accessible ( the url generated from action and controller name is reachable).

Sincerely yours,
Georgi Krustev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Leon Ren
Top achievements
Rank 1
answered on 28 Apr 2010, 01:10 AM
I just wanted to make a sample project to show your that the treeview cannot work properly in master page, but you know what, it works now!
 I got the problem. At the very beginning, i put the tree view in view page. Then i wanted to test whether it work in master page,  so i copied that code directly into master page, thus there exists two tree views with the same name, that's problem. The treeview in the master would never work, but the compiler didn't give me any warning.

Anyhow, thanks for your soon reply!
Tags
TreeView
Asked by
Leon Ren
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Leon Ren
Top achievements
Rank 1
Share this question
or