More in this section
Forums / General Discussions / CmsContentBase ID from Blog template

CmsContentBase ID from Blog template

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
3 posts, 0 answered
  1. Ned Bryant
    Ned Bryant avatar
    5 posts
    Registered:
    20 Apr 2004
    17 Jan 2011
    Link to this post
    Is there any way to get the ID of the current blog post within the external mapped template ContentViewSingleItem.ascx?

    Thanks!
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    17 Jan 2011
    Link to this post
    Hello Ned,

    Yes there is a way.  Add the code below to your template

    var Manager = newContentManager("Blogs");
    if(Context.Items.Contains(Manager.Provider.ContentItemKey))
    itemId = (Guid)((IUrlRewriteData)Context.Items[Manager.Provider.ContentItemKey]).Data;
    ...
    ....
      
    var cntItem = Manager.GetContent(itemId);
    var category = cntItem.GetMetaData("Category");
      
    ...
      
     // get all items from this category and list them


    Best wishes,
    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
  3. Ned Bryant
    Ned Bryant avatar
    5 posts
    Registered:
    20 Apr 2004
    17 Jan 2011
    Link to this post
    Perfect, thank you!
Register for webinar
3 posts, 0 answered