Disabling Row Select in GridControl

Hello -
Is there a way to disable the row select for a grid control? Currently, when the mouse hovers over the left most column, the cursor changes to the row select cursor. The CellCursor event does not appear to fire for Column 0.


1 Reply

AS Asarudheen S Syncfusion Team July 11, 2011 01:44 PM UTC

Hi Greg,

You can disable the row select for grid control along with the following code.


gridControl1.AllowSelection = GridSelectionFlags.Column | ~GridSelectionFlags.Row;


(or) through SelectionChanging event handler you can block some specific rows with the following code.


gridControl1.SelectionChanging += new GridSelectionChangingEventHandler(gridControl1_SelectionChanging);

private void gridControl1_SelectionChanging(object sender, GridSelectionChangingEventArgs e)
{
if (e.Reason == GridSelectionReason.MouseDown)
{
if (e.Range.IsRows)
{

switch (e.Range.Top)
{
case 1:
case 2:
case 3:

e.Cancel = true;
break;
}
}

}


Here is a sample for your refernce.

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=Forum350260140.zip

Please let me know if you need any further assistance.

Thanks,
Asarudheen.




Loader.
Up arrow icon