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.
Hello,
I am currently using PrepareViewStyleInfo to change the colour of a Row in a grouped table (GridGroupingControl), when a Row/Column is set to say ''True''. This value cannot be changed, so the colour doesnt need to be changed, once it has loaded.
But changing the colour in PrepareViewStyleInfo slows the table down. Is there another way to set the colours?
Thanks,
David.
ADAdministrator Syncfusion Team November 11, 2004 09:25 AM UTC
Another way you can do this is to use conditional formats.
GridConditionalFormatDescriptor cfd = new GridConditionalFormatDescriptor("Big");
cfd.Expression = "[Col2] > 4";
cfd.Appearance.AnyCell.BackColor = Color.LightBlue;
this.gridGroupingControl1.TableDescriptor.ConditionalFormats.Add(cfd);
Here is a forum thread with another sample. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=11621
DLDavid LlewellynNovember 12, 2004 07:35 AM UTC
Hello Clay,
Thank you for the information. Is there anyway to write an expression that will filter out records which are equal to say, "Bob".
I would then like to colour the row.
Something like -> cfd.Expression = "[ColumnName] = Bob";
cfd.Appearance.AnyCell.BackColor = Color.LightBlue;
this.gridcontrol.TableDescriptor.ConditionalFormats.Add(cfd);
I have tried this to no avail. Should I be enclosing the "Bob" string in quotes or something? Or am I unable to use the expression like this?
I have also got another question that is related to my previous one. I am setting the cells tooltip, in PrepareViewStyleInfo, to the same value that
is displayed in that cell.
Something like this :-
private void TableControl_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
GridRecordRow rec = this.gridcontrol.Table.DisplayElements[e.RowIndex] as GridRecordRow;
if(rec != null)
{
DataRowView colorrow = rec.GetData() as DataRowView;
try
{
if ((e.ColIndex > 3) && (e.ColIndex < 7)) e.Style.CellTipText = colorrow[e.ColIndex-3].ToString();
}
catch
{
}
}
}
This method REALLY slows down the grouping grid. Do you know of a better way of setting the tooltips of the cells?
Thanks again.
David.
ADAdministrator Syncfusion Team November 12, 2004 09:26 AM UTC
You would use the Like operator.
cfd.Expression = "[ColumnName] LIKE ''Bob''";
You use single quotes to delimit a string for the LIKE operator. (The web interface may double the single quote in teh above line.)
You could also use the MATCH operator.