Is the Simple Cookie Web part supposed to work with the Update Panel?

Pedro Costa asked on July 21, 2015 12:49

Hi Guys,

Did a test with a blank website with a Simple Cookie Law Consent web part and it's Use update panel property enabled.

Unfortunately this does not appear to work, the web part is not hidden after the partial postback, once you refresh the page totally it works properly and the consent is hidden.

I've debugged it and the OnPreRender event of the website is properly hiding the web part, however the update panel is not rewriting the DOM?

Has anyone else tried this? Or knows of a way to get it working properly, I want to prevent a full postback when the user accepts the cookie warning.

Many thanks in advance for your help,

Cheers, P.

Recent Answers


Pedro Costa answered on July 21, 2015 12:50

BTW, I'm running v8.2.28 as a precompiled web app.

0 votesVote for this answer Mark as a Correct answer

Roman Hutnyk answered on July 21, 2015 20:00

I'm afraid you'll need to handle partial update using javascript on your own. :(

0 votesVote for this answer Mark as a Correct answer

Pedro Costa answered on July 22, 2015 13:05

Hi Roman,

Thanks for the info, how best to proceed with that?

As I use a custom layout for the cookie web part, and am using deployment mode always on (so virtual files are source controlled) I've modified the code behind of my custom layout to:

private void SetComponents(bool visible, string text, bool allowAll, bool allowSpecific, bool allowDeny)
{
    if (!visible)
    {
        this.Visible = false;
        if (RequestHelper.IsPostBack())
            ScriptHelper.RegisterStartupScript(this.Page, typeof(string), "hideCookie", "$(function() { $('.politicaCookies').animate({ bottom: -100 });});", true);
        return;
    }

However if there's a better method of handling the partial update, please advice.

Cheers, P.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.