Harsh
Harsh

Reputation: 11

MVC 3 : Page Model not getting updated in Partial View after refreshing the page using jquery

I have a strange problem. I am trying to perform custom pagination in MVC using jquery. I am doing so by putting my grid in partial view of the parent page. When I update the view after the first time load, my model values are not getting updated on consecutive calls. Can someone please advise?

Upvotes: 1

Views: 454

Answers (3)

Swati Gupta
Swati Gupta

Reputation: 534

I think You need to refer this post. This could be linked to your problem as well.

Disable caching on a partial view in MVC 3

Upvotes: 1

wayne.blackmon
wayne.blackmon

Reputation: 761

I will seize upon the term grid. I assume you have constructed some sort of grid using html/razor/javascript etc. Then you placed it in a partial view. Now you want that grid to refresh after you do an update.

I have provided a comprehensive solution to the problem of displaying data in grid format using ASP.NET MVC 3 and the jQuery-UI plugin jqGrid.

ASP.Net MVC 3 JQGrid

The solution is ajax based and provides full CRUD functionality. You can convert the grid into a read-only grid if needed. I have not had any issues with model values not being updated.

Upvotes: 0

Stefan P.
Stefan P.

Reputation: 9519

It could be a caching problem, try to disable it by putting this attribute on your Controller:

[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]

Disable caching for all ajax calls in javascript:

$.ajaxSetup({ cache: false });

Upvotes: 0

Related Questions