Access to UserControls from Factory in order to set params

Topics: General, Troubleshooting
Mar 30, 2011 at 10:03 AM

Hi

Just finished Silverlight Plugin XSLT function and wanted to embbed it in UserControl with params....

UserControl howto

http://docs.composite.net/C1/ASP-NET/HelloWorldControl.aspx/Using-Web-User-Controls-in-C1

UserControl w params howto

http://docs.composite.net/C1/ASP-NET/ASPNETFAQ.aspx?q=How+do+I+set+parameters+on+ASP.NET+Controls%3f

So params will be set in Factory Class that resides in App_Code and User Controls resides somewhere else
ie \Frontend\UC.ascx.

Due to the fact that App_Code directory is compiled to other Assembly (App_Code.dll) it is not possible
to access UC.ascx and its class from Factory class in App_Code...

UserControls are not allowed in App_Code either....

In HowTo there is Calendar class, but how to access UC.ascx

What is scenario/workaround for this problem?

thanks&regards

mel

www.holisticware.net

 

Coordinator
Mar 30, 2011 at 11:38 AM

I haven't tested this, but perhaps using the "dynamic" keyword will do the trick? I.e. type your user control reference as "dynamic" and the do an explicit cast on return?

Mar 30, 2011 at 12:18 PM
Edited Mar 30, 2011 at 12:19 PM

I have with success created my own UserControls function that takes to params, both the Path but also a second one which is a comma seperated list of values. That means you can't assign complex values to the usercontrol but numbers and strings are just fine

<f:function xmlns:f="http://www.composite.net/ns/function/1.0" name="gl.dot.CompositeC1.Functions.LoadUserControl"> 
  <f:param name="Path" value="~/My/Path.ascx" /> 
  <f:param name="Params" value="param1=value1,param2=value2" />
</f:function>

Would that be useful to you? i can't paste the function code as well if you'd like.