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.
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.
ADAdministrator Syncfusion Team August 19, 2003 09:15 AM
> 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
ADAdministrator Syncfusion Team August 20, 2003 09:41 PM
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.