GridGroupingControl

I have a a grid with a master-detail relationship. I would like to iterate through each row and column and check the cell values one by one. I can't find a sample that helps me out 100%. There won't be any selected items at the time I want to do this and no events will be fired by the grid to kick off this process. Can anyone assist?

Thanks


4 Replies

SR Sri Rajan Syncfusion Team July 25, 2008 10:28 AM UTC

Hi MrMad,

Thank you for your interest in Syncfusion products.

You need to handle TableControlPrepareViewStyleInfo event to iterate each cell and check the values in MasterDetail GridGroupingControl. Please refer the below code for more details.

void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
{
if (e.Inner.Style.Text == "40")
{
e.Inner.Style.BackColor = Color.Red;
}
}

Please let me know if this helps.

Best Regards,
Srirajan.



AD Administrator Syncfusion Team July 25, 2008 12:13 PM UTC

Hi Srirajan,

Thanks for your assistance. The event you mentioned will not be fired at the time I want to scan through the cell values. I'm actually trying to convert an Infragistics grid and replace the following code:

foreach (Infragistics.Win.UltraWinGrid.UltraGridBand oBand in grdTasks.DisplayLayout.Bands)
{
foreach (Infragistics.Win.UltraWinGrid.UltraGridColumn oColumn in oBand.Columns)
{
foreach (Infragistics.Win.UltraWinGrid.UltraGridRow oRow in grdTasks.Rows)
{
string cellValue = oRow.Cells[oColumn].Text
}
}
}

Thanks



SR Sri Rajan Syncfusion Team July 28, 2008 07:29 AM UTC

Hi MrMad,

Thank you for your interest in Syncfusion products.

If your intension is to iterate through each row and column and check the cell values one by one, then please refer the code below. But if you want to change the cell properties(just like backcolor, celltype etc.,), then you can do that only using TableControlPrepareViewStyleInfo or QueryCellInfo events.

int rc=this.gridGroupingControl1.TableControl.Model.RowCount;
int cc=this.gridGroupingControl1.TableControl.Model.ColCount;
for (int i = 4; i <=rc; i++)
{
for (int j = 1; j <=cc; j++)
{
Console.WriteLine(this.gridGroupingControl1.TableControl.Model[i, j].Text);
}
}


Please let me know if you have any further questions.

Best Regards,
Srirajan.




AD Administrator Syncfusion Team July 29, 2008 01:48 PM UTC

Very useful. Thanks.


Loader.
Up arrow icon