Article relates to
RadGridView for WinForms
April 2, 2008
Last modified by
RadGridView provides a vehicle to use custom context menus, instead of the default one, depending on the element clicked. To learn how to set a custom context menu to appear everytime the user right-clicks the RadGridView, regardless of the element of the control they click, please visit RadGridView Custom Context Menu KB Article.
In this example, we will create two different context menus, and attach them to cells in the second and third columns in RadGridView. If the user right-clicks in a cell the second column, they will get the first custom context menu. If they click in the third column, they will get the second context menu. If they right-click any other element of the RadGridView, the default context menu will be shown.
Start by creating the context menus, initializing its items, and subscribing for the events that you want to handle to achieve the desired behavior.
Subscribe to the ContextMenuOpening event, and in its handler, add the conditions to be used to set the corresponding context menu to be displayed upon clicking of an item.
This example illustrates only one of the scenarios, possible with the context menu infrastructure in the RadGridView. You can set a context menu depending on a variety of conditions, such as a particular value in a column, or a complex condition including multiple values from a row.
Copyright © 2016, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.