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.
Hi,
A few questions about conditionally setting cell properties:
1. In the below code sample, the readonly property is being properly set in the desired columns and rows. The backcolor property, however, is being improperly set to red in what appear to be random rows. After the initial load of the grid, clicking on random rows will produce random red cells (although all in the proper column).
2. Why would this exact same code produce no result in the PrepareViewStyleInfo event?
3. What''s the simplest way change the textcolor of a cell once it''s been edited?
Please note that all columns are initialized to ReadOnly = true.
private void gridLedger_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if(data condition is met...)
{
this.gridLedger.Model.IgnoreReadOnly = true;
e.Style.ReadOnly = false;
e.Style.BackColor = System.Drawing.Color.Red;
this.gridLedger.Model.IgnoreReadOnly = false;
}
}
Regards,
Neal
ADAdministrator Syncfusion Team November 5, 2004 06:10 PM UTC
Try not using IgnoreReadOnly to see if this will avoid the problem. It should not be needed in QueryCellInfo.
Here is a KB on why ReadONly needs to be set in QueryCellInfo and not PrepareViewStyleInfo.
http://www.syncfusion.com/Support/article.aspx?id=10351
To set the color while you are editing, try handling PrepareViewStyleInfo. If the e.ColIndex and e.RowIndex point to the current cell (grid.CurrentCell.RowIndex and grid.CurrentCell.COlIndex) and grid.CurrentCell.IsEditing, then set teh color.