Adding Blog Post Titles to a Dropdown List 5.0
Hi,
I am working on creating a blog post summary page and would like to query a list of all blog post titles. I've figured out how to query blog posts using the API but I can't figure out how to actually get the title of the post. All of the examples I am finding use GetMetaData but it doesn't look like this option is available in Sitefinity 5.02860.
Here is an example snippet I found on in this post, how do I convert this to work with 5.0?
protected
void
Page_Load(
object
sender, EventArgs e)
BlogManager manager =
new
BlogManager(
"Blogs"
);
IList listOfAllPosts = manager.Content.GetContent();
foreach
(IContent cnt
in
listOfAllPosts)
string
val = (
string
)cnt.GetMetaData(
"Title"
);
ListItem item =
new
ListItem(val,val);
DropDownList1.Items.Add(item);
I've figured out the answer.
Here is the updated code:
BlogsManager manager = BlogsManager.GetManager();
var listOfAllPosts = manager.GetBlogPosts();
foreach
(IContent cnt
in
listOfAllPosts)
string
val = (
string
)cnt.Title;
ListItem item =
new
ListItem(val, val);
DropDownList1.Items.Add(item);