I have a view have 10 record , i want when i click buttion loadmore then get add 10 record next from database.
this is view
@model IEnumerable
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
var page = (int)ViewData["page"];
}
Index
@foreach (var item in Model)
{
@item._ID------@item._Name-----@item._Age----@item._Adress
$(document).ready(function () {
$(".page-number").click(function () {
var page = 1;
$.ajax({
type:"POST",
url: '@Url.Action("Index", "Home")',
data: { "page":page+2},
async: true,
success: function (data) {
$("#listStudent").html(data);
}
});
});
});
and cotroller
public ActionResult Index(int page=1)
{
List Students = Getdata(page);
ViewData["page"] = page;
return View(Students);
}
duong doPosted Jun 13, 2015, 12:01 PM
Sanjay SabariyaPosted Jun 13, 2015, 6:57 AM
duong doPosted Jun 13, 2015, 4:12 AM
Saineshwar BageriPosted Jun 13, 2015, 1:47 AM