Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > one template - many user controls View modes: 
User avatar
Member
Member
neil-myfitfund - 9/21/2010 6:38:00 PM
   
one template - many user controls
Hi,

Question - can you create a user control that is dynamic based on the name of the page? For instance, having one style of layout that always has a user control which appears in the left hand corner. But the actual user control is different from page to page. Instead of creating a template for each user control, can you macro the user control somehow? Just trying to maximize using the same layouts while just modifying the part that appears.

Just curious - thanks!

User avatar
Kentico Support
Kentico Support
kentico_radekm - 10/18/2010 1:47:15 AM
   
RE:one template - many user controls
Hello.

If you want to change content of your control only, this can be done in code-behind of given file. You can get name of current page via CMS.CMSHelper.CMSContext.CurrentDocument.DocumentName. You can use macros as well. Except of default macro types (Context value, Cookie value,...) you can use custom macro option, which allows you to call your custom code.

Best Regards,
Radek Macalik