title: How to create pagination based on column data
body: <p>I am creating a view in mvc5 app to show only data from the current year. I would like that when the user clicks on arrow at bottom of page, the table data should change to show data from previous year. What is the best approach to do this? Should I load the entire table and then select the appropriate data based on user clicking or through ajax?</p>
  
  <p>I have researched about pagination, but all the research shows how to create pages based on number of rows, I would like to split the table based on  data and with the user clicking previous or next(not page numbers).</p>
  
  <p>This is my view. I want to paginate based on the year in actualcompleted date.
  What is the best approach?</p>
  
  <pre><code>            @foreach (var item in Model.AllCompletedAccToMonth)
              {
  
                  &lt;tr&gt;
                      &lt;td&gt;
                          @Html.DisplayFor(modelItem =&gt; item.ApartmentBlock.BuildingID)
                      &lt;/td&gt;
  
  
                      &lt;td&gt;
                          @Html.DisplayFor(modelItem =&gt; item.ApartmentBlock.Address)
                      &lt;/td&gt;
  
                      &lt;td&gt;
                          @Html.DisplayFor(modelItem =&gt; item.Apartment.ApartmentNumber)
                      &lt;/td&gt;
  
                      &lt;td&gt;
                          @Html.DisplayFor(modelItem =&gt; item.RenovationDetails)
                      &lt;/td&gt;
                      &lt;td&gt;
                          @Html.DisplayFor(modelItem =&gt; item.Contact.CompanyName)
                      &lt;/td&gt;
                      &lt;td&gt;
                          @Html.DisplayFor(modelItem =&gt; item.ActualCompletedDate)
                      &lt;/td&gt;
  </code></pre>