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

Forums / General Discussions / CmsContentBase ID from Blog template

CmsContentBase ID from Blog template

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:
    09 Dec 2016
    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