简体   繁体   English

MVC 3:使用jquery刷新页面后,部分视图中的页面模型未更新

[英]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. 我正在尝试使用jquery在MVC中执行自定义分页。 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? 有人可以请教吗?

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 在MVC 3中禁用部分视图上的缓存

It could be a caching problem, try to disable it by putting this attribute on your Controller: 可能是缓存问题,请尝试通过将此属性放在Controller上来禁用它:

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

Disable caching for all ajax calls in javascript: 禁用javascript中所有ajax调用的缓存:

$.ajaxSetup({ cache: false });

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. 我假设您已经使用html / razor / javascript等构建了某种网格。然后将其放置在局部视图中。 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和jQuery-UI插件jqGrid以网格格式显示数据的问题提供了全面的解决方案。

ASP.Net MVC 3 JQGrid ASP.Net MVC 3 JQGrid

The solution is ajax based and provides full CRUD functionality. 该解决方案基于ajax,并提供完整的CRUD功能。 You can convert the grid into a read-only grid if needed. 如果需要,可以将网格转换为只读网格。 I have not had any issues with model values not being updated. 我没有模型值未更新的任何问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM