The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
When I click on a "Display Color" button, I want to set "Area" column cell's backcolor to RED OR WHITE according their value for all rows in Grouping Grid Control.
I have used these line of code, but they do not work, no color changes.
I want to put codes in Button click event instead of putting them in GGC event like QueryCellStyleInfo.
do you have any idea to do so?
Thanks,
Lan
//gdBase is Grouping Grid Control //for all visible rows in GGC, set column "Area" backcolor to //RED if it is <100, WHITE if it is >=100 int ColIndex = gdBase.TableDescriptor.VisibleColumns.IndexOf( "Area" ); ColIndex = gdBase.TableDescriptor.FieldToColIndex( ColIndex ); foreach (Record rec in this.gdBase.Table.FilteredRecords) { int RowIndex = gdBase.Table.DisplayElements.IndexOf(rec);
//test area value object oVal=rec.GetValue("Area"); if (oVal==null || oVal==DBNull.Value || Convert.ToInt32(oVal)<100) { //red style.BackColor=Color.Red;
RCRajadurai C Syncfusion Team February 9, 2009 05:36 AM UTC
Hi Lan,
Thanks for your interest in Syncfusion products.
The cell specific properties like BackColor (other than CellValue or Text) cannot be set using an indexer like this.gridGroupingControl1.TableModel[4,3].BackColor=Color.Red. In ggc, the only data storage is the bound datasource. That only holds a single value. It does not hold TextColor, or Backcolor, or any of the other many cell specific properties.
Inorder to set cellspecific properties in ggc, you have to handle QueryCellStyleInfo event handler. However, you can control this event to be fired through a button click event based on your own settings.
Please refer to the following code snippet in which the code within the QueryCellStyleInfo event get executed only when the button click event occurs. bool b = false; //button click event private void button1_Click(object sender, EventArgs e) { b = true; this.gridGroupingControl1.TableControl.Refresh(); }