We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

FieldDescriptor set to null when Expression set??

Thread ID:

Created:

Updated:

Platform:

Replies:

45229 Jun 14,2006 10:40 PM UTC Jun 15,2006 05:12 PM UTC WinForms 2
loading
Tags: Grouping
Martin Nitschke
Asked On June 14, 2006 10:40 PM UTC

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"))

Administrator [Syncfusion]
Replied On 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");

Martin Nitschke
Replied On June 15, 2006 05:12 PM UTC

Great, thanks!

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;