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.
I was wondering why this is happening?
GridColumnDescriptor colDesc = grid.TableDescriptor.Columns["ColName"];
//colDesc.FieldDescriptor is not null here
grid.TableDescriptor.ExpressionFields["ExpressionColumn"].Expression = "Value";
// FieldDescriptor is null here after 2nd line executes
if (colDesc.FieldDescriptor.GetPropertyType() == Type.GetType("System.Boolean"))
ADAdministrator Syncfusion Team June 14, 2006 11:58 PM UTC
The column descriptor collection is immutable meaning that when it is changes, a new insance of it needs to be created with the change. So, the old descriptor that you cached in a local variable was nulled out when the new collection was created as the result of modifying the expression. But if you access the descriptor directly from the collection, and not through a local variable, you will get the new instantiated descriptor for that column. So, this code shows none-null values in both places.
GridColumnDescriptor colDesc = gridGroupingControl1.TableDescriptor.Columns["Col0"];
if(colDesc.FieldDescriptor != null)
Console.WriteLine("not null A");
this.gridGroupingControl1.TableDescriptor.ExpressionFields["Expression"].Expression = "=[Col2]";
colDesc = gridGroupingControl1.TableDescriptor.Columns["Col0"];
if(colDesc.FieldDescriptor != null)
Console.WriteLine("not null B");