Click here to Skip to main content
15,921,295 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using mvc razor ..

There , i call a actionresult from other actionresult

for exp, if i am on home page , and i click ,productlist ,

this is actionresult and as view called productlist.cshtml

I pass datatable in productlist.cshtml using model ..

and display in table using
HTML
<div id="some_grid_container">
foreach (var item in Model) {
    
}
</div>

and after this , i use
HTML
<div id="myPager">
@Html.PagedListPager(Model, Page_No => Url.Action(@ViewBag.cururl, new { Page_No,destn,callhere}))
</div>

on a href click in PagedListPager , the page refreshes,
so i dont want to refresh page, so i tried
HTML
$('#myPager').on('click', 'a', function () {
	    $.ajax({
	        url: this.href,
	        type: 'GET',
	        cache: false,
	        success: function (result) {
	            alert(result);
	         //   $('#some_grid_container').html(result);
	        },
	        error: function (xhr, textStatus, errorThrown) {
	         //   document.write("FAIL: " + xhr.responseText + "-" + textStatus.responseText + "-" + errorThrown.responseText);
	            alert("FAIL: " + xhr.responseText + "-" + textStatus.responseText + "-" + errorThrown.responseText);
	        }
	    });
	    return false;
	});

this doesnot refresh whole page , but this shows whole html page from start inside div id="some_grid_container"..

how to refresh only div some_grid_container with Page_no =2 values , then 3 ...etc...


I hope you understood
Posted
Updated 12-Jun-14 22:33pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900