Safely disable the RadControls embedded jQuery in Sitefinity

December 10, 2012
Note: This will only work for editions of sitefinity running at least RadControls Q2 2012

jQuery double loading in Sitefinity sucks if you're anal about every last byte :) ...

If you follow the documentation though and disable via the web.config sitefinity just goes to hell in a hand-basket because it relies heavily on the RadControls.  When it was being developed way back, this wasn't a feature OF the RadControls so why would they account for it.

Solution: Conditionally disable it in your masterpage

The answer is as simple as checking to see if you're in design mode...and then not disabling it. 

protected void Page_Init(object sender, EventArgs e)
{
    if (this.IsDesignMode() && this.IsPreviewMode() == false)
    {
        //In DESIGN MODE
 
    }
    else
    {
        //IN PREVIEW OR LIVE MODE
        ScriptManager1.EnableEmbeddedjQuery = false;
    }
}

I've been running like this for over a week with zero issues...it's my new standard going forward.

So clearly this requires a .master Masterpage.  It also assumes that you have a RadScriptManager on your page called "ScriptManager1".  I assume if you don't you could write up something to find the injected manager and disable it that way.

Cheers,
Steve


Image Description

Steve McNiven-Scott

Best\Only Blogger on this site. Therefore defacto blogger of the year Award Winner.