[帮助-SharePoint]在SharePoint中提交表单时更新视图不​​受影响 [英] [Help - SharePoint] Updating view does not affect while submitting form in SharePoint

查看:107
本文介绍了[帮助-SharePoint]在SharePoint中提交表单时更新视图不​​受影响的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在基于Views构建搜索Web部件时遇到问题.

我使用代码来更改当前视图的CAML查询,以使数据列表显示搜索结果.
但是,当我提交表单(用于搜索)时,视图已更新,但是在重新加载或重新提交表单之前,数据列表没有任何变化.

这是单击提交按钮时我的部分代码:

Hi all,

I had a problem while building search Web part based on Views.

I used codes to change the CAML query of the current view to make the Data List display the search result.
But when I submit the form (for searching), the view has been updated but there was nothing happened to the Data List until I reload or resubmit the form.

Here''s my part of codes while submit button was clicked:

SPWeb thisWeb = SPContext.Current.Web;
SPView view = thisWeb.Lists["listname"].Views["viewname"];
string querystring = //Generate the CAML query
view.Query = querystring;
view.Update();


我认为在我的代码更新后,该视图未加载.
有什么方法可以使其立即更新(我不需要重新加载或重新提交表单)?

谢谢!


I think the view did not load after my codes updated it.
Is there any way to make it updates immediately (I do not need to reload or resubmit the form)?

Thank you!

推荐答案

我知道了.

提交表单之前,只需模拟更新视图即可.您可以使用AJAX解决此问题!

谢谢大家!
I got the solution.

Just simulate update view before submitting the form. You can use AJAX to solve this problem!

Thanks all!


您只是在更新与显示内容无关的视图对象.显示的数据列表需要刷新,以便使用更新的视图.
You are only updating the view object which has nothing to do with what is displayed. The DataList being displayed needs to be refreshed so the updated view will be used.


这篇关于[帮助-SharePoint]在SharePoint中提交表单时更新视图不​​受影响的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆