We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ContextMenuStrip DeleteRow on Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

106853 Jan 29,2013 09:43 AM UTC Jan 30,2013 04:28 AM UTC WinForms 1
loading
Tags: GridControl
joao cardoso
Asked On January 29, 2013 09:43 AM UTC

z
Hi guys...

I'm trying to create on ContextMenuStrip for right click on a row... so far so good with the code:

public Form1()
        {
            InitializeComponent();
            GridControl new_grid = new GridControl();           
            new_grid.Size = new Size(500, 500);
            new_grid.MouseDown += new System.Windows.Forms.MouseEventHandler(this.new_grid_MouseDown);
            this.Controls.Add(new_grid);
        }

        private void new_grid_MouseDown(object sender, MouseEventArgs e)
        {
            GridControl grid = (GridControl)sender;
            if (e.Button == MouseButtons.Right)
            {
                if (grid.Selections.Count > 0)
                {
                    foreach (GridRangeInfo selection in grid.Selections)
                    {
                        if (selection.IsRows)
                        {
                            this.ContextMenuStrip = row_menu;
                            row_menu.Show(Control.MousePosition.X, Control.MousePosition.Y);
                        }
                    }
                }
            }
        }


Now I need to pass the gridcontrol to the item clicked event of ContextMenuStrip: private void row_menu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)

How can i do that ? ?

Thanks in advance.

Vinish Kumar K [Syncfusion]
Replied On January 30, 2013 04:28 AM UTC

Hi Joae,

 

 

Thank you for your interest in Syncfusion products.

 

Query

Context menu Item Clicked event.

We have analyzed your query. In your update, You have provided code context menu in Mouse down event. Please refer the following codes to pass the gridControl.

 

private void formatCellsToolStripMenuItem_Click(object sender, EventArgs e)

        {

            GridFormatCellDialog f = new GridFormatCellDialog(this.gridControl1);

            f.ShowDialog();

        }

 

<Installed_Path>\Syncfusion\EssentialStudio\10.4.0.71\Windows\Grid.Windows\Samples\2.0\Dynamic Formatting\Format Cells Demo

 

Please refer the sample from Syncfusion Essential Studio Dashboard. We have format the cell using Context menu click in sample.

 

Please let me know if you have further concerns regarding this. Please provide the sample and replication procedure if I misunderstood your sample. This will help us to provide better solution.

Let me know your concerns.

Regards,

Vinish.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;