Need help asap: How to retrieve the ID of the selected blogpost in a blogCancel

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.

How will I be able to get the primary key or ID of the blogpost that I selected in the blogpostlist..

Here is the scenario..

I dragged a blogpost control on my page and then when I previewed it it will show all the post that I created. When I clicked one of the links of a specific post
say "Full Story", it will be redirected to a page displaying the details of the post.

Where can I get the ID of that post in the redirected page or how I will get it.

Hi Ivan,
Thanks its great it did the trick. How about if I want to get the ID of the blogpost in the blogpost list? Is there a metadata specific only for the ID of the blogpost so that I won't have to traverse each blogpost that I have?

To follow up what I really wanted to happen is that I want to add another field in the BlogPostList on the page showing the rating of that specific post that is why I have to get the ID of the each post displayed.. I know I can do this by traversing in every items in BlogManager.GetBlogs and then GetPosts but is there an easier way for me say there is already a metadata for that specific post so I wouldn't have to traverse on all BlogPosts?

I tried to create an asp.net server control and derive it from BlogPost control and tried to override the setitemmetadata method in your example..However I was unable to load the post. Can you guide me on how I will accomplish your example from your previous reply.

1. Make sure your project has App_Code folder. If not, right-click on the Website in your project (in Visual Studio) and then go to "Add ASP.NET folder" and then click on "App_Code"
2. Add new class to the App_Code folder and name it "CustomBlogPosts"
3. A If you are NOT working with Sitefinity 3.6 paste following in the class (delete anything that was there when you created a class):

using Telerik.Blogs.WebControls;

using System.Web.UI;

using Telerik.Cms.Engine;

/// <summary>

/// Custom implementation of BlogPosts

/// </summary>

publicclass CustomBlogPosts : BlogPosts

{

/// <summary>

/// Sets metadata controls for the post that is currently binding.

/// This method is invoked when content item is data bound.

/// </summary>

/// <param name="itemContainer">The control that contains the item layout template.</param>

4. Open web.config file and locate <toolboxControls> collection
5. Add following line inside of the <toolboxControls> collection (after the <clear /> declaration):

<add name="Custom Blog Posts"

section="Blogs"

description="Custom implementation of the BlogPosts control"

type="CustomBlogPosts, App_Code"/>

6. Make sure you have in the template control with ID="ratingControl" and which implements ITextControl interface (Label, Textbox and so on).

If you are using version prior to Sitefinity 3.6 you can find blog templates in ~/Sitefinity/ControlTemplates/Blogs/ folder. If you are working with Sitefinity 3.6 please consult following articles for mapping templates:

Tools

Sitefinity Professional Services

Progress, Telerik, Sitefinity and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries.