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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Essential Grid and Reflection

Thread ID:

Created:

Updated:

Platform:

Replies:

6584 Aug 19,2003 02:24 AM UTC Aug 21,2003 02:41 AM UTC WinForms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 19, 2003 02:24 AM UTC

Hello. Does someone know how can I access to Essential Grid's and Columns' properties via PropertyInfo.GetValue, SetValue. I have following code: PropertyInfo oProperty=null; oProperty=EssColumn.StyleInfo.GetType().GetProperty("CellAppearance") if (oProperty.CanRead) { object oValue = oProperty.GetValue(EssColumn.StyleInfo,null); - here I get exception "'System.Reflection.TargetInvocationException' occurred in mscorlib.dll" } However following works without exception: oProperty.SetValue(EssColumn.StyleInfo,SomeValue,null); Thanks to anybody who can help.

Administrator [Syncfusion]
Replied On August 19, 2003 02:15 PM UTC

> Hello. Does someone know how can I access to Essential Grid's and Columns' properties via PropertyInfo.GetValue, SetValue. > I have following code: > PropertyInfo oProperty=null; > oProperty=EssColumn.StyleInfo.GetType().GetProperty("CellAppearance") > if (oProperty.CanRead) > { > object oValue = oProperty.GetValue(EssColumn.StyleInfo,null); - here I get exception "'System.Reflection.TargetInvocationException' occurred in mscorlib.dll" > } > However following works without exception: > oProperty.SetValue(EssColumn.StyleInfo,SomeValue,null); > > Thanks to anybody who can help. Hi Dmitry, I modified the samples\databound\gdbdmultiheader sample in order to reproduce the problem. I added using System.Reflection; and I added the following lines at the end of Form1_Load: PropertyInfo pi = this.gridBinder.InternalColumns[0].StyleInfo.GetType().GetProperty("CellAppearance"); object ob = pi.GetValue(this.gridBinder.InternalColumns[0].StyleInfo, null); Trace.WriteLine(ob); That seems to work fine. Can you tell me what you are doing different? Thanks, Stefan

Administrator [Syncfusion]
Replied On August 21, 2003 02:41 AM UTC

The main problem is that I create GrigColumn with System.Activator. In this way I cannot access it via InternalColumns. But this is not critical. I discovered that when Activator creates new object of GridColumn some fields are undefined, and this causes exception when I try to read such a field. I think this is a problem of .net itself not Syncfusion. Thank you.

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.

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

;