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

[Solved] Pass parameter to window

1 Answer 154 Views
Window
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Lilia
Top achievements
Rank 1
Lilia asked on 30 May 2011, 04:33 PM
Hello,

Can you give me any advice how can I pass parameter value to Telerik Window?
I have the following case. I'm using Telerik TreeView (treeview of users hierarchy) and I'm trying to create a context menu (I didn't found telerik context menu). From the context menu I can create new nodes to the TreeView (new users), so when I select to add new user from the context menu a Telerik Window opens. I must pass a value to that window that indicates to what node I must add new node. Here is a piece of my code:
//the telerik window
Html.Telerik().Window().Name("WindowUser").Title("Add new user").Content(
@<text>
     @Html.Partial("~/Views/Shared/_UserePartial.cshtml")
</text>).Render();

The .content(selectedUser) function is not working for me because it's deleting my previous content in the Window. So how can I pass the selected user from the TreeView to the Window?
Here is the jquery context menu:
var selectedUser = ''; //contains the selected user from the treeview
 var menuUser = [
     { 'Option 1': function (menuItem, menu) { alert($(menuItem).html()); } },
     $.contextMenu.separator,
     { 'New User': function (menuItem, menu) { $('#WindowUser').data('tWindow').content(selectedUser).center().open(); } }
];
 
//add the context menu to the treeview nodes
 jQuery(function ($) {
     $('.menuFranchise').contextMenu(menuUser, { theme: 'vista' });
 });
 
//gets the selected user from the treeview
function onTreeViewSelect(userName) {
            selectedUser = userName;
}

1 Answer, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 31 May 2011, 01:23 PM
Hello Lilia,

Indeed, the content client-side method sets the window content. Since you are using the Content() server-side method, the content of the UserePartial.cshtml is rendered along with the view page and you can interact with it directly.

All the best,
Alex Gyoshev
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
Tags
Window
Asked by
Lilia
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Share this question
or