Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
How to show context WebDataMenu on a web datagrid right-click
posted

Hi,

i'm using a datagrid and i want  to by clicking right click a context web data menu appear to edit the selected row in the datagrid and then when i choose an item from the context data menu i need an modal popup appear containing the informations to insert it to datagrid ! thanks in advance

  • 17590
    Offline posted

    Hello safa dkl,

    What I can suggest for achieving your requirement is using the WebDataMenu as your context menu and display it ot the right click of the mouse. 

    [code]

     <ig:WebDataMenu runat="server" ID="ContextMenu" IsContextMenu="true" 
            BorderStyle="Solid" BorderWidth="1" BorderColor="#CCCCCC">
            <ClientEvents ItemClick="MenuItem_Click" />
            <Items>
                <ig:DataMenuItem Text="Select Current Row" Key="Select" ImageUrl="/SamplesBrowser/SamplesCommon/aspnet/WebDataGrid/EditingAndSelection/RowContextMenu/sendto.png" />
                <ig:DataMenuItem Text="Edit" Key="Edit" ImageUrl="/SamplesBrowser/SamplesCommon/aspnet/WebDataGrid/EditingAndSelection/RowContextMenu/edit.png" />
                <ig:DataMenuItem Text="<%$ Resources:WebDataMenu, ContextMenuDelete %>"
                    Key="Delete" ImageUrl="/SamplesBrowser/SamplesCommon/aspnet/WebDataGrid/EditingAndSelection/RowContextMenu/stop.png" />
            </Items>
        </ig:WebDataMenu>

    [/code]

    Regarding your second requirement what I reccommend is making a template with textboxes for the values of the grid cells and manually bind them with the corresponding fields of the grid.

    [code]

      <ClientBindings>
                                            <ig:RowEditingClientBinding ColumnKey="CompanyName" ControlID="control1" GetValueJavaScript="$get({ClientID}).value"
                                                SetValueJavaScript="$get({ClientID}).value={value}" />
                                            <ig:RowEditingClientBinding ColumnKey="Contact" ControlID="control2" GetValueJavaScript="$get({ClientID}).value"
                                                SetValueJavaScript="$get({ClientID}).value={value}" />
                                            <ig:RowEditingClientBinding ColumnKey="Address" ControlID="control3" GetValueJavaScript="$get({ClientID}).value"
                                                SetValueJavaScript="$get({ClientID}).value={value}" />
                                            <ig:RowEditingClientBinding ColumnKey="City" ControlID="control4" GetValueJavaScript="$get({ClientID}).value"
                                                SetValueJavaScript="$get({ClientID}).value={value}" />
                                            <ig:RowEditingClientBinding ColumnKey="PostalCode" ControlID="control5" GetValueJavaScript="$get({ClientID}).value"
                                                SetValueJavaScript="$get({ClientID}).value={value}" />
                                            <ig:RowEditingClientBinding ColumnKey="Country" ControlID="control6" GetValueJavaScript="$get({ClientID}).value"
                                                SetValueJavaScript="$get({ClientID}).value={value}" />
                                        </ClientBindings>

    [/code]

    A sample project demonstrating your scenario could be found at:

    https://www.infragistics.com/samples/aspnet/data-grid/row-context-menu

    Feel free to contact me if you need any further support.