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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Contextmenu on Header Row

Thread ID:





17839 Aug 18,2004 06:24 AM UTC Aug 18,2004 07:21 AM UTC WinForms 1
Tags: GridControl
Anil Kumar M
Asked On August 18, 2004 06:24 AM UTC

Hi I am having a context menu for my Databounddatagrid, I am enabling contextMenu when user clicks on cells which are not static and readonly. I am doing this in grid_MouseDown event like this if(e.Button == MouseButtons.Right) { if(this.Grid.CurrentCell.ColIndex != 1 && this.Grid.CurrentCell.ColIndex != 2) { Grid.ContextMenu=null; } else { Grid.ContextMenu=this.cmnuContextMnu; } } here Columns ColIndex 1 & 2 cells are non static. the above code works fine when i am clicking on static and nonstatic cells but when i click on Columns Headers cells the ContextMenu still popsup, how do i get the RowIndex in mousedown event. to get the row index(RowIndex = 0 for header row cells), i used cellclick event in which i had placed the above MouseDown event code..but still iam having the problems is there any way i can effectively show the contextmenu only on non static cells. how do desable context menu for header row cells. ---seash

Administrator [Syncfusion]
Replied On August 18, 2004 07:21 AM UTC

You can get the row/column with code like this:
int row, col;
Point pt = new Point(e.X, e.Y);
if(grid.PointToRowCol(pt, out row, out col, -1))
    // row and col should point to the cell


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon