AD
Administrator
Syncfusion Team
February 16, 2007 08:00 PM UTC
Hi Sanath,
You can do this by handling the SelectedRecordChanging event of the grid and set e.Cancel to true for specified records. Before handling this event, you can turn of the cell based selection using TableOptions.AllowSelection property to None. Andthen enable the record based selection using ListBoxSelectionMode property. Here is a code snippet.
this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.None;
this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;
this.gridGroupingControl1.SelectedRecordsChanging +=new SelectedRecordsChangedEventHandler(gridGroupingControl1_SelectedRecordsChanging);
private void gridGroupingControl1_SelectedRecordsChanging(object sender, SelectedRecordsChangedEventArgs e)
{
if( e.SelectedRecord != null && e.SelectedRecord.Record != null)
{
Record rec = e.SelectedRecord.Record;
int iIdValue = int.Parse(rec.GetValue("ID").ToString());
if( iIdValue % 2 == 0 )
e.Cancel = true;
}
}
Let me know if this helps.
Best regards,
Haneef