2
votes

I have inherited the coreresultswebpart in a custom webpart that I am building in sharepoint 2010. The reason for this is because there are some properties that I want to set by default, without any manual entry.

The webpart is working fine except, when the webpart is loaded in the page, it does not immediately show the results (search result exists for the default configurations). But when I hit the enter key on the adress bar, the results are loaded. The results are also loaded when I am in edit mode. However, when I click OK in the editorpart, the results vanish and the webpart tells me to refresh page, at which point, the same cycle repeats.

What am I missing?

Here is a code snippet of where I am making the change:

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

1 Answers

1
votes

try to override ConfigureDataSourceProperties Method.

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();
       }
}