How to programmatically access label for custom field in blog
Telerik,
Using the native API, I am able to retrieve values from custom fields in a blog post using
DataExtensions.GetValue(dataItem, fieldName). My question is, how can I get the associated label for this fieldname? For example, In a blog post, I have a custom field named "question1". The label for question1 is "Name an animal with 4 legs". So using the GetValue extension method, I can get the value for this question, but how do I programmatically get the "Name an animal with 4 legs" part of question1? Please advise using native API syntax.
Here's some simplified example code:
1.
BlogsManager blogsManager = BlogsManager.GetManager();
2.
// get all published blogs items
3.
var allBlogs = blogsManager.GetBlogPosts().Where(b => b.Status == ContentLifecycleStatus.Live).ToList();
4.
(
string
)DataExtensions.GetValue(allBlogs,
"question1"
);
Hello Mark,
Can you please share with us the widget template you are currenlty using for your blog posts widget so we can give you a more specific advice? Please note that by adding the custom field on your template this will display just the value of the field, can you please make sure you have not added the label separately?
Regards,
Boyan Barnev
the Telerik team