【问题标题】:Page refresh does not load the search results on customized coreresultswebpart sharepoint 2010页面刷新不会加载自定义 coreresultswebpart sharepoint 2010 上的搜索结果
【发布时间】:2011-12-24 23:55:28
【问题描述】:

我继承了我在 sharepoint 2010 中构建的自定义 webpart 中的 coreresultswebpart。 之所以这样,是因为有一些属性我要默认设置,不需要手动输入。

webpart 工作正常,但在页面中加载 webpart 时,它不会立即显示结果(默认配置存在搜索结果)。但是当我点击地址栏上的回车键时,结果就被加载了。当我处于编辑模式时,也会加载结果。但是,当我在 editorpart 中单击 OK 时,结果消失了,webpart 告诉我刷新页面,此时重复相同的循环。

我错过了什么?

这是我进行更改的代码 sn-p:

protected override void OnLoad(EventArgs e)
{
    CssRegistration.Register("/_layouts/WPLatestBlogFeed/LatestBlogFeed_CustomStyle.css");
    base.OnLoad(e);
    if (firstLoad)
       {
           firstLoad = false;
            CustomizeWebPart();
       }
}

【问题讨论】:

    标签: sharepoint sharepoint-2010 web-parts


    【解决方案1】:

    尝试覆盖 ConfigureDataSourceProperties 方法。

    protected override void ConfigureDataSourceProperties()
    {
        // run the base code
        base.ConfigureDataSourceProperties();
        CssRegistration.Register("/_layouts/WPLatestBlogFeed/LatestBlogFeed_CustomStyle.css");
        base.OnLoad(e);
        if (firstLoad)
           {
               firstLoad = false;
                CustomizeWebPart();
           }
    }
    

    【讨论】:

    • 你好 Hechler,谢谢你的评论。我之前确实尝试过,但在 base.ConfigureDataSourceProperties(); 遇到了一个问题。甚至在加载 web 部件之前,代码就抱怨缺少搜索词!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-06
    • 1970-01-01
    • 2012-08-06
    • 1970-01-01
    • 2014-03-19
    • 2014-05-15
    相关资源
    最近更新 更多