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
close icon

Disable Row

Hi there,
I'm pretty new to the syncfusion grid.

I've used the GridGroupingControl grid and added a list of objects to the DataSource. All ok, the data is shown. Now i want to disable certain rows in the grid.

How can I do that? How can I access the row and set it to disable?

thanks for any help!
Michael

2 Replies

RC Rajadurai C Syncfusion Team May 22, 2009 09:05 AM UTC

Hi Michael,

Thanks for your interest in Syncfusion products.

If your intention is to disable certain rows in grid, then please try the following code in handled in QueryCellStyleInfo event.

void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellType.AlternateRecordFieldCell)
{
if (e.TableCellIdentity.ColIndex > 0)
{
Element el = e.TableCellIdentity.DisplayElement;
Record r = el.GetRecord();
if (r != null)
{
int row = e.TableCellIdentity.Table.UnsortedRecords.IndexOf(r);
if (row == 7)
e.Style.Enabled = false;
}
}
}
}

This checks for record at index 7 and disables it.

Regards,
Rajadurai


ME Michael Egloff May 25, 2009 10:47 AM UTC

Hej Rajadurai,
that's exactly what is was looking for!

Thanks a lot.
Michael

Loader.
Live Chat Icon For mobile
Up arrow icon