Ticket T251266
Visible to All Users

ASPxGridView - Customize Context Menu based on Row KeyValue

created 10 years ago

Hi,

I'm trying to customize my contextmenu in a gridview.

What I'm trying to do is to add elements to my context menu that depends of my row key value. Once I've got the row key value, I must call my database and then populate the contextmenu with the results.

I don't see any server events where I can do it (the FillContextMenuItems is not good for me because it is called once for every row, I must find an event fired for each.

Any sample or idea??

Thanks

Answers approved by DevExpress Support

created 10 years ago (modified 10 years ago)

Hello,

If you simply need to show/hide menu items based on the row's KeyValue, use the ASPxClientGridView.ContextMenu client-side code (identical for the WebForms and MVC platforms) in the T212881: GridView ContextMenu Event fires too fast - How to hide particular Item based on Row Values report.
If this is not what you are looking for, please describe your scenario in greater detail. Some screenshots with the actual and expected result and a sample project with your current progress would be helpful.

Updated
Please see the ASPxGridView - How to change certain context menu items' visibility or their enabled state depending on both whether a corresponding row is selected and a part of its data example that demonstrates how to customize an ASPxGridView Context Menu based on a certain row value or state (selected/unselected). Let me know if it meets your requirements.

    Show previous comments (1)
    DevExpress Support Team 10 years ago

      Hello Ankri,

      Please see the ASPxGridView - How to change certain context menu items' visibility or their enabled state depending on both whether a corresponding row is selected and a part of its data example that demonstrates how to customize an ASPxGridView Context Menu based on a certain row value or state (selected/unselected). Let me know if it meets your requirements.

        Sorry not to have had time to go sooner to see the answer. What I want is to create an item that corresponds with the row, if the user has 50 jobs displays with 5 questions for each, I won't create a menu with 250 items and later set them to visible or not.
        I'll try to find a solution with the contextmenu and the clientside.
        Thanks

        DevExpress Support Team 10 years ago

          Sure, but please let me know if you need my further assistance.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.