0

I have database table with many records, I want to list every 10 items into 1 page depending on how many records there are.

My code so far lists them in a single page:

@foreach (var item in results)
{
    <a href="~/ViewInscription.cshtml?id=@item.RecordID">

    <div>Inscription : @item.RecordID</div> <br />
    <p style="float:left">@item.Text</p>
    <img src="@item.img1" />
    <br />

    </a>
}

Results is the result out of the SELECT statement:

The items will increase more often so there is no specific number of items

I'm building .net webpages using .net with c# Razor syntax

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
user2962142
  • 1,916
  • 7
  • 28
  • 42
  • 1
    First result in google: 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 – Juan Carlos Jun 02 '16 at 16:21
  • Turns out that `asp.net mvc` offers a nuget package [PagedList.Mvc](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) for that. – Veverke Jun 02 '16 at 16:29
  • im not building a MVC website – user2962142 Jun 02 '16 at 16:33
  • You will need to track your page size and current page and pass these into your backend. Something like http://stackoverflow.com/questions/2380413/paging-with-linq-for-objects – Steve Greene Jun 02 '16 at 17:48

0 Answers0