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

Forums / Developing with Sitefinity / How to force only single item display

How to force only single item display

4 posts, 0 answered
  1. Len
    Len avatar
    14 posts
    Registered:
    10 Jul 2008
    28 Jan 2009
    Link to this post
    I have more-or-less successfully created my first module based on the generic content module.  The module displays and manages stories.  I can insert the module in the centre column of a page and it shows the stories.  I have also coded a user control which sits in the sidebar and shows random links to the stories.

    I would like to force the module to show a single, complete story and I cannot figure out how to do so.  I can set the number of items to 1 but the complete story is not shown, rather a link to 'full story' is shown.  I found some docs for SF 3.2 which talk about the BehaviorMode having a single item mode, which sounds like what I want, but that doesn't seem to apply under SF 3.5.

    I'm sure there's a way for me to accomplish this.  Any help would be most appreciated.

    Thanks,
    Len

  2. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    30 Jan 2009
    Link to this post
    Hi Len,

    ContentView based controls in Sitefinity 3.5 do have BehaviorMode property. In order to display single item you will need to provide two values to your control:
    • BehaviorMode = BehaviorModes.Details - property
    • itemId = id of the content item you wish to display - public field

    I hope you'll find this information helpful. Let us know if there is anything else we can do for you.

    All the best,
    Ivan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Len
    Len avatar
    14 posts
    Registered:
    10 Jul 2008
    30 Jan 2009
    Link to this post
    Thank you Ivan.

    One more question: is there an easy way for me, or the customer, to find out the id of the story they wish to see as the default on the page?  I don't see any field listing that in the admin interface.

    Len

  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    03 Feb 2009
    Link to this post
    Hi Len,

    The ID is indeed not listed anywhere on the page.
    You can take it through our APIs though. There is a method - GetContent(), which returns all content items. Then, you can iterate through these items until you reach the one you need (by comparing the Title metafield for example). Then just see the ID property of that content item.

    I hope this helps.

    All the best,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
4 posts, 0 answered