Access to UserControls from Factory in order to set params

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


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

UserControl howto

UserControl w params howto

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?




Mar 30, 2011 at 12:38 PM

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 1:18 PM
Edited Mar 30, 2011 at 1: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="" name=""> 
  <f:param name="Path" value="~/My/Path.ascx" /> 
  <f:param name="Params" value="param1=value1,param2=value2" />

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