More in this section

Forums / Developing with Sitefinity / Variables in Generic Content Module

Variables in Generic Content Module

2 posts, 0 answered
  1. David
    David avatar
    50 posts
    14 Jan 2009
    21 Apr 2009
    Link to this post

    A client of ours wants to be able to add values from a database field into Generic Content on the website. For example, the client has a block of text in a Generic Content Control which appears on many pages, and it contains this line:

    "Please join us at our upcoming event on Saturday, May 9, 2009!"

    The events are updated daily, and they would like to be able to have the date of this block of text updated with the database field. I would simply create a user control for this, but they still want to be able to update the rest of the text with the Generic Content control.

    Any ideas are greatly appreciated.

    Thank you,
  2. Dido
    Dido avatar
    149 posts
    24 Sep 2012
    22 Apr 2009
    Link to this post
    Hello David,

    I have recently implemented something very similar.

    What is the idea:
    • Create a new control inheriting GenericContent
    • On Render, connect to the database and get the text you need. Just write it.

    Here is a list of problems you might encounter
    • You need ToobloxItemAttribute and a ToolboxItemAttribute pointing to your custom implementation.

    There is an article devoted to customizing GenericContent. Be sure to check the FAQ first. You don't need embedded templates and writing base to string. In your Render you will do something of the sort:
    YourManager manager = new YourManager(); 

    If you need more details, feel free to ask.
    Kind regards,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
2 posts, 0 answered