How to show blog posts one below the other?

I am writing a blog app. on MVC 4. I am designing the home page where blog posts appear one below the other.

What to use to show this type of display? There should be pagination. I want only five posts per page.

rpk2006

What to use to show this type of display? There should be pagination. I want only five posts per page.

First, you must define how you make the pagination( url, hidden fields, javascript, ajax …)
Then you can read MVC tutorials for pagination

http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/sorting-filtering-and-paging-with-the-entity-framework-in-an-asp-net-mvc-application

I would also suggest reading a bit on HTML and Bootstrap – that might help you much.

A good site to start with is

http://www.w3schools.com/html/html5_intro.asp

http://www.w3schools.com/bootstrap/default.asp

@ignatandrei:

Pagination is OK. The first part is how to show posts one below the other.

Go through some basic tutorials on MVC and they’ll cover this kind of thing, to show things in a list just output them in a for loop.

@model IEnumerable<SomeModelThatHoldsYourBlogData>

@foreach(var blog in Model)
{
    <h1>@Html.ActionLink(blog.Title, "View", "Blog", new {id=blog.ID})</h1>
    <h2>@blog.DateUpdated.ToString("dd MMM yy") by @blog.Author</h2>
    <p>
        @blog.SummaryText
    </p>
}

Leave a Reply