Turn your User Controls into Dynamic Content

by: Allan Thræn

UPDATE 2009-11-02: This code for this project has now been moved to CodePlex.


I have just made a new version of the Dynamic Content Plugin introduced here and expanded here. This time I introduced the ability to turn your existing User Controls into Dynamic Content, just by adding an attribute to the class. I’ve also (inspired by Anders Hattestads excellent blog post). Complete feature list:

  • Forget about web.config, register Dynamic Content by putting a [DCPlugin(DisplayName=””,Description=””)] attribute on top of your IDynamicContent implementing class.
  • Have all your property types registered automatically so they can also be used as Dynamic Content
  • Turn any user control into a Dynamic Content element by putting a [DCPlugin(DisplayName=””,Description=””,Url=”~/url-to.ascx”)] on top of it. All public properties of type PropertyData, String, Int32 or PageReference will automatically be exposed as properties in the Dynamic Content.
  • Easily create Dynamic Content by inhering from the base class “DynamicContentBase”. Handles property serialization easily.
  • Simple deployment – just drop the DCPlugin.dll in your bin – and include it as a reference in your project.

 

Get the full project or just the binary.

09 February 2009


Comments

  1. Nice implementasion. Guess its only a matter of time before make a web part wrapper. It seems that most code is in place.
  2. *before you makes...
  3. Makes life so much easier
  4. You made me a happy man....
  5. I have a question because I can't seem to get this to work. I have added the .dll file in bin and added the DCPlugin code to my class. To display, I am using a simple . I am getting a pop up box to add my property, I type and save it. It adds a dynamic content property to my editor, but when I publish, it does not display. Am I missing something? I am on CMS 5 R2. Any help would be appreciated. Thanks.
  6. Sorry, I forgot code doesn't come through. To complete my sentence, I am using a simple Leftbracket percent pound MyIntegerProperty percent Rightbracket code to display. Nothing shows up.
  7. Nevermind! It was something really silly too... I changed my AutoEventWireup to True and it now displays. I have been banging my head on that one too! It's always the little things :P
Post a comment    
User verification Image for user verification  
Allan Thræn

About me

I am a product manager @ EPiServer, with a passion for the more geeky side of things. My technical interests are typically focused around user problems, user experience,  search, information management, artificial intelligence and  personalization

On top of this blog I have the blog Allan On Technology and I often crosspost.

DISCLAIMER: Unless otherwise stated in the posts, this blog expresses my personal opinions, experiments and views, not necessarilly the views of EPiServer AB.

 1564 page views this week.

 

 

Syndications


Archive


Tag cloud

EPiTrace logger