I'm trying to populate one of my unordered list () with items from my DB automatically just as the page has finished loading up. What I need to know is how to get the items. I don't think anything is wrong with the Controller and PartialView. All I need is how to call it from the index page.
The Following code is from the index page:
<div class="contentRight">
<span class="contentRightHeader">Most Followed Questions ·</span><span class="contentRightViewAll"> View all</span>
<ul>
<!--<li>Why do we drink and whats the effects on the body</li>
<li>Why do we drink and whats the effects on the body</li>-->
</ul>
</div>
This code is from the controller:
public PartialViewResult _ListMostFollowedQuestions()
{
QuestionManager qman = new QuestionManager();
ViewBag.Questions = qman.ListMostFollowedQuestions(3);
return PartialView("_ListMostFollowedQuestions");
}
And lastly from my partialView:
@foreach (var item in ViewBag.Questions)
{
@item.Topic Deadline:
@item.Deadline
}
Thanks for the help!
Ajaxto load your list after loadingindexpage