Sitefinity ASP.NET CMS - Content Management System

Support Forum Thread

Home >  Support >  Forums home > Sitefinity 3.x > Developing with Sitefinity > Add a Generic Content to a User Control

Reply
Justin, 7/21/2008 12:35:37 AM
Hi all,
I'm hoping for a pointer on where to start.  The developer guide has a section that seems just like what I need to do but I'm not super familiar with sitefinity or asp.net yet to put it all together.  here's what I want to do:

Our site layout has a sidebar on the right.  The CSS template we are using has a class called "sidebox" which when applied to a div tag which creates a simple gray box container.  Users can drop a Generic Content control onto the sidebar but then they would need to go into HTML view and create a div wrapper around their content with the class="sidebox" element in order to get the gray box around their text.  Not all text in the sidebar would be in a sidebox.  So I thought it would be a good user experience to wrap the Generic Content control in a customer user control which simply puts the div with the sidebox class around that instance of the Generic Content control.

I followed, best I could, the example in the user guide, but the result is that I cannot edit the contents of the Generic Content but can only set the properties for it.

Is this the best approach to do what I'm considering here?  It's on v 3.2 + Sp2 + hotfix.  If there are any examples of this sort of thing please let me know.

Thanks!
Justin

Reply
, 7/21/2008 10:35:05 AM
Hello Justin,

I have attached an example that demonstrates how to achieve the required functionality. Also, you can find a detailed explanation about wrapping GenericContent control in a user control in the Developer Manual.

Do let us know if this helps.

Sincerely yours,
Pepi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center

Reply
Justin, 7/21/2008 10:03:35 PM
Thanks Pepi.  It works great.

I had followed the instructions in the Developer Guide (the same link you sent) but the control I made didn't work.  I compared to your code and saw that I missed the IContentContainer inheritance on the class.

Thanks for the help!!
Justin