troubleshooting Question

c# how do I get the rowindex from a contextmenu?

Avatar of jackjohnson44
jackjohnson44 asked on
.NET ProgrammingC#
4 Comments1 Solution2601 ViewsLast Modified:
I have a context menu with an event handler for the menu item.  I can get into it, but I can't get the rowindex that was clicked on.

        public static void DataGridViewContextMenuOptionChain(this DataGridView dataGrid)
        {
            ContextMenuStrip contextMenuStrip = new ContextMenuStrip();
            ToolStripMenuItem toolStripToggleActive = new ToolStripMenuItem("Toggle Active");
            ToolStripMenuItem toolStripDeleteChain = new ToolStripMenuItem("Delete Chain");

            toolStripToggleActive.Click += toolStripToggleActive_Click;
            toolStripDeleteChain.Click +=toolStripDeleteChain_Click;
            contextMenuStrip.Items.AddRange(new ToolStripItem[] { toolStripToggleActive, toolStripDeleteChain});
            dataGrid.ContextMenuStrip = contextMenuStrip;
        }

        private static void toolStripDeleteChain_Click(object sender, EventArgs e)
        {
            throw new NotImplementedException();
        }
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros