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

Working with a Context Menu

1 Answer 60 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 16 Sep 2011, 09:56 PM
Hi,

Very new to the RAD controls so please bear with me as I have moved over from Infragistics and CSOM is totally different.
I have implemented a context menu using the RadContextMenu and so far so good.  However I can't work out how to access the data for the selected row client side.

What I am trying to do is to get a value from a cell in the row clicked on when the context menu was invoked.  I have tried :-

var commandName = args.get_item().get_text();
if (commandName == "Properties")
{
// Get the row selected in the tree
var treeList = $find("<%= componentTree.ClientID %>");
var row = treeList.get_selectedItems()[0]; 
var componentID = treelist.getCellByColumnUniqueName(row, 'EmployeeID');
alert(componentID); 

// ...amd from the row get the component id
window.open("./componentproperties.aspx?componentid=" + componentID + "&src=compview"); 

}

But this does not work - reading a bit further I don't think that the get_selectedItems is returning the selected rows which is a bit of a flaw in my understanding of this.  Any advice please on how to get the value of  call from the selected row?

1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 21 Sep 2011, 12:33 PM
Hello Chris,

Please examine the Integration with RadContextMenu demo to see how the desired functionality can be implemented.
The get_item() property of the event arguments of the OnItemContextMenu event is the right-clicked TreeListDataItem object.

I hope this helps.

Greetings,
Mira
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
TreeList
Asked by
Chris
Top achievements
Rank 1
Answers by
Mira
Telerik team
Share this question
or