I have a custom server control for asp.net. One of the properties available to it is a generic object. That generic object has custom attributes that are read and used to customize the rendering of the control.
At run time, this is no problem, since all I need to do is find all the attributes on the instance that gets passed into the control.
However, just as the "DataSource" member of controls can call up a list of object types at design time, I would like to be able to bring up a list of types in the host assembly. There is no need for actual instances, since I'm rendering based on attributes.
This is an example property from the host control:
[Browsable(true)]
[TypeConverter(typeof(TheObjectConverter))]
public object TheObject
{
get { return _theObject; }
set { SetTheObject(value); }
}
What I want to have happen is to have TheObjectConverter be able to load the assembly of the host page for the control.
I even a full recursion against .GetReferencedAssemblies(), with no luck. It seems I am unable to load the assembly of the control's host at design time. Is that correct, or is there a way to do this?
90ni1823
0 Points
3 Posts
Is it possible for a custom asp.net control to load types at design time from the assembly hostin...
Sep 12, 2009 02:46 AM|LINK
I have a custom server control for asp.net. One of the properties available to it is a generic object. That generic object has custom attributes that are read and used to customize the rendering of the control.
At run time, this is no problem, since all I need to do is find all the attributes on the instance that gets passed into the control.
However, just as the "DataSource" member of controls can call up a list of object types at design time, I would like to be able to bring up a list of types in the host assembly. There is no need for actual instances, since I'm rendering based on attributes.
This is an example property from the host control:
[Browsable(true)] [TypeConverter(typeof(TheObjectConverter))] public object TheObject { get { return _theObject; } set { SetTheObject(value); } }What I want to have happen is to have TheObjectConverter be able to load the assembly of the host page for the control.
None of the following seem to work
I even a full recursion against .GetReferencedAssemblies(), with no luck. It seems I am unable to load the assembly of the control's host at design time. Is that correct, or is there a way to do this?
assembly reflection "design time"