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

a GridView in GridView and a ContextMenu

2 Answers 98 Views
GridView
This is a migrated thread and some comments may be shown as answers.
lina fetisova
Top achievements
Rank 1
lina fetisova asked on 14 Jul 2010, 01:27 PM
Good day!
I have a GridView with Details (which open by click on plus), and details page contains a GridView with Details (the details are a GridView too).
The first GridView has a ContextMenu and it looks like the inner grids have the same ContextMenu :(
But I want the ContextMenu to be only at the first GridView (in a pinch at the first and at the second GridView, but not at third) - how can I do it?

2 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 16 Jul 2010, 12:43 PM
Hi lina fetisova,

Indeed the default behavior of the grid is to show the Context Menu both for the parent and the child grids. So, in your case you can use the Open event of the menu, verify that the current element is the child grid and set the its IsOpen property to "False". For example:

void rowContextMenu_Opened(object sender, RoutedEventArgs e)
        {
            RadContextMenu menu = sender as RadContextMenu;
            var parentGrid = menu.GetClickedElement<RadGridView>();
 
            if (parentGrid.ParentRow != null)
            {
                menu.IsOpen = false;
            }
        }

I am sending you a sample project illustrating the proposed solution.
Furthermore, you can find more information about using RadContextMenu with RadGridView in our online documentation and in this blog post.


Greetings,
Maya
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
lina fetisova
Top achievements
Rank 1
answered on 19 Jul 2010, 03:59 AM
Great thanks to you, Maya!
Tags
GridView
Asked by
lina fetisova
Top achievements
Rank 1
Answers by
Maya
Telerik team
lina fetisova
Top achievements
Rank 1
Share this question
or