How can a control such as a treeview control be accessed from a different view file from where it is declared. Or is this not possible?
Thanks in advance,
Eugene
5 Answers, 1 is accepted
I am not sure what you requirement is. How do you want to access the control - client or server side? Also which product are you using?
All the best,
Atanas Korchev
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.

We are using Telerik's Telerik.Web.Mvc.dll version 2010.1.309.135. To clarify my question, if I stored the tree variable on the server, say in a Session variable, how would I do that? For instance,
$.getJSON(
"/Home/GetArticle", { dtree: $('#TreeViewDiscussion') }, function(json) {...}
The above attempt causes a crash.
Or how would I store the variable in document.cookie on the client? What is the type of the treeview object and do we need to know what it is in order to pass the variable?
Thanks in advance,
Eugene
I still do not understand what you are trying to achieve. What do you mean by "treeview variable" ? Could you please explain why you need to access the component and store it in session? I am pretty sure there is an easier way to achieve the task at hand.
Regards,
Atanas Korchev
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.

OK. A treeview control is defined in index.aspx as follows:
<%
= Html.Telerik().TreeView()
.Name(
"TreeViewDiscussion")
%>
The tree is populated when the application starts with the following client side binding code:
$.getJSON(
"/Home/LoadDiscussion", { articleNodeValue: json.ID }, function(result) {
//alert("related items: text = " + result.text + " value = " + result.value);
$(
'#TreeViewDiscussion').data('tTreeView').bindTo([result]);
});
Then, when the user radopens a window to add data to the tree, the tree needs to be updated in a javascript function on that window's page after the user clicks a submit button on that page, as follows:
function submitbtn() {
var $id;
var title = $('#txtTitle').val();
var msg = $('#Message_Text').val();
//alert(title + " " + msg);
$.post(
"/Discussion/NewPost", { txtTitle: title, Message_Text: msg }, function(str) {
$id = str;
});
CloseWnd();
//Close discussion dialog window
$.getJSON("/Home/LoadDiscussion", { articleNodeValue: $id }, function(result) {
var dtree = result.dtree;
var artID = result.ArticleID;
alert(artID);
???.data(
'tTreeView').bindTo([result]);
});
}
In order to do this, the tree object is needed where the ??? are placed in the above code. How do I get that object; it is not defined on this page. Or is there a better way to accomplish this?
Sincerely,
Eugene
Since the treeview is in the parent page of RadWindow I suggest you check this help article. It should be something like this:
GetRadWindow().BrowserWindow.$('#TreeView').data(...)
All the best,
Atanas Korchev
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.