0

I read about the popup menu in the documentation here. I'm not clear as to whether this menu is already provided and we just have to enable a particular property to make it available? Or is it just an example of a popup menu and needs to be created? I've just begun exploring devexpress grids and any help would be appreciated.

neuDev33
  • 1,573
  • 7
  • 41
  • 54

2 Answers2

2

This topic is devoted to the XtraGrid - the Winforms Grid. The ASPxGridView does not provide this menu, you may try to implement it yourself as it is shown in the

ASPxGridView - How to implement showing/hiding columns in the manner similar to ASPxPivotGrid

example.

platon
  • 5,310
  • 1
  • 22
  • 24
0
It is possible we can create context menu on aspxgridview. Find the following example for aspxgridview context menu.



Default.aspx:
=============


<dx:ASPxGridView ID="grvContexMenuExample" runat="server" AutoGenerateColumns="false"
    KeyFieldName="ID" EnableViewState="true" ClientInstanceName="grdtest" Width="100%"
    Settings-GridLines="None" OnHtmlRowPrepared="grvContexMenuExample_HtmlRowPrepared">
    <ClientSideEvents ContextMenu="function(s,e) {
                                                       if(e.objectType == 'header')
                                                        {
                                                               headerContextMenu.ShowAtPos(e.htmlEvent.clientX, e.htmlEvent.clientY);
                                                         }
                                                         else if(e.objectType == 'row')
                                                         {
                                                             headerContextMenu.ShowAtPos(e.htmlEvent.clientX, e.htmlEvent.clientY);
                                                         }
                                                    }" />
    <Columns>

    <%--Your columns goes here--%>
        <columns>
</dx:ASPxGridView>

<!--Start New  Context Menu !-->
<dx:ASPxPopupMenu ID="mnContextMenu" runat="server" ClientInstanceName="headerContextMenu"
    EnableAnimation="false" PopupHorizontalAlign="OutsideRight" PopupVerticalAlign="TopSides"
    PopupAction="RightMouseClick">
    <Items>
        <dx:MenuItem Text="New Context Menu1">
        </dx:MenuItem>
    </Items>
    <ClientSideEvents ItemClick="ContextMenuItemClick" />
</dx:ASPxPopupMenu>
<!--End New   Context Menu !-->







Default.aspx.cs:
================

  protected void grvContexMenuExample_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e)
        {


            if (e.RowType == GridViewRowType.Data)

                if (e.RowType == GridViewRowType.Header)
                {

                    e.Row.Attributes.Remove("oncontextmenu");
                }


        }