Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 MVC 3 和剃须刀引擎制作网站。我有一个 WebGrid,它有一个 ViewModel 作为它没有更新的源。奇怪的是它只在我重新编译项目时更新,我想通过 ajax 调用或至少通过页面刷新来更新它。
我解决了它,但我不知道为什么它不适用于我提出的第一个解决方案。我的 ViewModel 中有一个静态方法,它重新调整了 webgrid 用作其模型的 Viewmodel 对象列表。它从两个不同的数据库中查询并填充 Viewmodel 对象。
我不得不将该方法移动到控制器并使用 Viewmodel 对象作为要传递给 webgrid 的数据的容器,并且它可以工作。