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

How to get row type?

Hi.
I want to get current type of selected row.
for example in CurrentCellStartEditing event, I want to allow editing in filter row and cancel editing when row type is normal.
thanks.

3 Replies

NK Neelakandan Kannan Syncfusion Team February 4, 2015 05:36 PM UTC

Hi Ramin,

 

Thank you for using Syncfusion products.

 

If you want to restrict the cell editing when CurrentCellStartEditing event, you can enable Cancel property based on your condition. Please make use of below code,

 

Code Snippet:

void gridGroupingControl1_TableControlCurrentCellStartEditing(object sender, GridTableControlCancelEventArgs e)

{

if (style.TableCellIdentity.TableCellType != GridTableCellType.FilterBarCell)

{

If(//Specify your needed condition)

{

e.Inner.Cancel = true;

}

else

{

e.Inner.Cancel = false;

}

}

}

 

Please let me know if you have any concerns.

 

Regards,

Neelakandan



RA Ramin Alirezaee February 4, 2015 10:19 PM UTC

Hi.
Thanks for your attention.
Everything is Okay.
There was only one problem, style was not declared.
I've added the following line to the first line of your code.

GridTableCellStyleInfo style = this.gridGroupingControl1.Table.GetTableCellStyle(e.TableControl.CurrentCell.RowIndex, e.TableControl.CurrentCell.ColIndex);

Thank you.


NK Neelakandan Kannan Syncfusion Team February 5, 2015 09:45 AM UTC

Hi Ramin,

Regret for the inconvenience caused.

You can get style of the current cell by using GetTableViewStyleInfo method. Please make use of below code,

Code Snippet:

void gridGroupingControl1_TableControlCurrentCellStartEditing(object sender, GridTableControlCancelEventArgs e)

{

GridTableCellStyleInfo style = this.gridGroupingControl1.TableControl.GetTableViewStyleInfo(e.TableControl.CurrentCell.RowIndex, e.TableControl.CurrentCell.ColIndex);

if (style.TableCellIdentity.TableCellType != GridTableCellType.FilterBarCell)

{

e.Inner.Cancel = true;

}

else

{

e.Inner.Cancel = false;

}

}

Please let me know if you have any concerns.

Regards,

Neelakandan



Loader.
Up arrow icon