Setting Options properties deeper than the first level

Answered
0
0

Hi.

I tried to follow the github documentation on setting dxDataGrid Extension Options property. I’ve had no problem when the anonymous property to be set is on the first level. However, I have hit exceptions when they are on second level or bellow. For example, the following code will complain the anonymous reference is null:


this.dxDataGrid1.Options.paging.pageSize = 100;

But it will work if I code it like this:


this.dxDataGrid1.Options.paging = new { pageSize = 100 };

I noticed the dxCircularGauge uses the first method mentioned and it works fine.:


this.dxCircularGauge1.Options.scale.label.visible = this.checkBox1.Checked;

What am I missing that I should pay attention to when I need to set deeper level properties?

Thanks in advance.

Ivan
(Wisej 2.2.46.0 – VS 2019 – C#)

  • You must to post comments
Best Answer
0
0

Hi Ivan,

 

Your observation is correct, you can’t use the member accessor to create and assign a value to an anonymously-created property.

The reason it works for the dxCircularGauge is because the value and existing member hierarchy has been defined in the “Options” property.

 

Either way is fine to create and assign the values to the dx widget configuration, just depends on your application needs!

 

Also note, if you change a multi-level value, you need to call widget.Update() to push the updated configuration changes to the client.

 

HTH,

Levie

  • You must to post comments
0
0

Hi Levie.

Thanks for the explanation.

Cheers.

Ivan

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.