it's really bad practise to render a user control using xslt, in fact, i think it's just not possible. Instead, you can always create a macro referecing your user control and put the macro onto your template.
yes, whatever you wanted to do using the xslt, you'll have to do this in c# code, probably making use of the nodeFactory to loop through your nodes. Here's a small code snippet to get you started:
var node = new Node(1000); var childNodes = node.Children; foreach (var childNode in childNodes) { //do whatever you need to do here }
Don't forget to add the relevant assemblies and using statements
oh yes you can, but i thought there's some performance penalties using the inline script as it gets compiled each time you request some function from the inline script (not sure if this is still valid for the latest version, but guess it still is)
Rendering a .net userControl
Hi,
Can someone explain to me how do i get to render a userControl I created in Visual Studio?
I already inserted the dll my marcos and XSLT.
Now when viewing the Page content it is returning me
Instead I want to be able to view a link to be able to Add products to my basket.
Here is how i inserted my control in my XSLT
<xsl:value-of select="umbraco.library:RenderMacroContent('<?UMBRACO_MACRO macroAlias="cart" runat="server"></?UMBRACO_MACRO>', '1115')"/>
//fuji
Fuji,
it's really bad practise to render a user control using xslt, in fact, i think it's just not possible. Instead, you can always create a macro referecing your user control and put the macro onto your template.
Hope this helps.
Regards,
/Dirk
Dirk,
Thanks for pointing this out, I need to make a loop in there so how do i make this if am using only the macro?
Do i need to make this in the userControl itself?
Fuji
yes, whatever you wanted to do using the xslt, you'll have to do this in c# code, probably making use of the nodeFactory to loop through your nodes. Here's a small code snippet to get you started:
Don't forget to add the relevant assemblies and using statements
Hope this helps.
Regards,
/Dirk
Can i used
in my XSLT and loop everything in here instead of looping it in my userControl??
//fuji
oh yes you can, but i thought there's some performance penalties using the inline script as it gets compiled each time you request some function from the inline script (not sure if this is still valid for the latest version, but guess it still is)
Cheers,
/Dirk
Well need to give it a try i know it works under version 4.5.1..
I'll let you know how it works. Thanks Dirk
//fuji
However is it possible to make a loop in a Template?..
//fuji
sure it is possible, just include the code snippet in <% %> syntax...
Cheers,
/Dirk
I will try this out....
//fuji
is working on a reply...