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

Context menu / databound radhostitem fun

1 Answer 77 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 2
Mike asked on 28 May 2009, 04:17 PM
Hi there,

I've been using your product in trial extensively and we're just about to purchase it, and it's been a great pleasure to use, with excellent forums covering 90% of what I've wanted to try and do so far.

I'm currently stuck on something that I just can't get to work.

I'm trying to provide certain database bound historical information in a right-click context menu (/panel).
The consist of another datagrid of information, and depends on the row being right-clicked.

I have implemented a RadGridView with a custom context menu event handler

-Opens a manual connection to my database and executes a stored procedure returning certain drill down information contextually on the row I'm looking at.
-Sets the DataSource of a RadGridView to point at my newly acquired data
-Creates a RadDropDownMenu;
-Creates a new RadHostItem to host the "History" RadGridView, and then finally
-Sets the ContextMenu to be this newly created RadDropDownMenu
-Sets appropriate MinimumSize fields so that the hosted item is properly sized and visible.

This actually works the first time I right click on something, but only the first time. 
After that, the context menu that appears always contains the same data, no matter if I clear it.

There are some questions surrounding this:-
-How can I update the datasource of a RadHostItem's hosted control (I tried using RadControlHostItem, a derived class that basically exposes the "HostedControl" as a Control on the RadHostItem)
-Is creating the HistoryGrid at design time as I've done a bad idea ? I ask because I found programmatically instantiating a RadGridView very awkward and it never quite worked as expected.
-What happens to the control "x" when you instantiate a RadHostItem(x)? I ask because the grid does disappear, even when I tried to instantiate the RadHostItem pointing at a copy of the grid, rather than the grid itself (I admit I'm extremely new to C# so this may be because I don't know how to clone an existing object...)
-Having "surfed" the object "e.ContextMenu" at runtime in debug mode, it seemed to have the RadHostItem with grid inside and the grid showing a datasource that had the right data in it.. (may be going mad), could there be some form of contextmenu caching that has caught me out or is this a red herring?

I realise this is quite an involved question, but it is causing quite a headache, so any pointers or hints would be most welcome!

I'm also open to suggestions like "Have you thought of using this completely different component and approach to achieve a similar result" type of thing!

Mike Renwick

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 29 May 2009, 01:50 PM
Hi Mike,

I have replied to your support ticket. I am not copying the answer here because I did not provide a solution, I need to understand a few things.

Kind regards,
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Asked by
Top achievements
Rank 2
Answers by
Telerik team
Share this question