This is a migrated thread and some comments may be shown as answers.

type of gridview rows

1 Answer 92 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Teresa
Top achievements
Rank 1
Teresa asked on 25 Mar 2014, 05:42 PM
I have a RadContextMenu assigned to my RadGridView 
I want this only be displayed when the user clicks a row with 
data that is not displayed when the user click on header of RadGridView

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 27 Mar 2014, 08:18 AM
Hi Teresa,

Thank you for writing.

You can use the MouseDown event of the grid, where you can check if the clicked cell is a data cell and only then to show the context menu, instead of assigning it to the control:
void radGridView1_MouseDown(object sender, MouseEventArgs e)
{
    if (e.Button == System.Windows.Forms.MouseButtons.Right)
    {
        GridDataCellElement dataCell = radGridView1.ElementTree.GetElementAtPoint(e.Location) as GridDataCellElement;
        if (dataCell != null)
        {
            //show the context menu
        }
    }
}

I hope this helps.

Regards,
Stefan
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
GridView
Asked by
Teresa
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or