+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Custom Control Content Sharing

Custom Control Content Sharing

7 posts, 0 answered
  1. Ken Tilley
    Ken Tilley avatar
    3 posts
    Registered:
    01 Sep 2009
    18 Aug 2010
    Link to this post
    Hi there,

    I've just started implementing my own custom controls and have a simple links list that displays hyperlinks from Sitefinity or external links - wherever the user chooses basically. It's nice & simple but I just realized if I create a list of links for use on, say, the homepage template & want to re-use the custom list on an internal template I'll need to copy the links data from one control to the other.

    I figure I should therefore implement content sharing in my control so I can share lists across templates.

    Can you give me any pointers as to what control base/interface I should look into to add content sharing to my custom control?

    Thanks in advance!
  2. George
    George  avatar
    204 posts
    Registered:
    05 Sep 2006
    18 Aug 2010
    Link to this post
    Hi Ken,

    You can use the Lists Module to create the list of your links and then you can read the items in that list using the API to generate the list of links on your controls. This way you will have one place to edit your links and the same list will be displayed on all of your templates.

    Cheers,

    George
  3. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    18 Aug 2010
    Link to this post
    Hello Ken Tilley,

    Create a helper class that will be used to create/populate all instances of your user controls. By doing so the links source will be the same for these controls.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  4. Ken Tilley
    Ken Tilley avatar
    3 posts
    Registered:
    01 Sep 2009
    18 Aug 2010
    Link to this post
    Thanks for the speedy response!

    George: I didn't want to use the list module as I wanted the data entry to be absolutely bullet proof - the end user would also be able to add all kinds of stuff into each list item (and then complain to me why the image they'd added to the list wasn't showing;) )

    Ivan: Is there a 'how to' guide to implement your suggestion? Also, how about the UI - how would my non-techy user go about selecting the appropriate content item? I'd envisaged having the share content functionality of the generic content control, but maybe this is a bit over-ambitious?

    thanks again for your help guys!

    Ken
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    18 Aug 2010
    Link to this post
    Hello Ken Tilley,

    You can use Control Designers or WebUITypeEditor

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Ken Tilley
    Ken Tilley avatar
    3 posts
    Registered:
    01 Sep 2009
    18 Aug 2010
    Link to this post
    Thanks Ivan.

    I have used those resources in order to build the control but I didn't see anything on sharing the content. Currently the list of links is serialized into a string and that string is saved into sitefinity.

    My question is: how can I select the data source programatically rather than one serialized string being associated with one control? Basically, how do I create one list and then share that between any control instance?

    thanks again!
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    18 Aug 2010
    Link to this post
    Hi Ken Tilley,

    Options

    1. Helper class that will be used to populate your controls and inside this class you will make the actual binding

    2. Populating the controls from common XML where the data has been stored

    3. Populating the controls directly from database table/s.

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
7 posts, 0 answered