Thursday, March 3, 2011

How can I force my SharePoint AjaxSmartPart to use the smaller "Release" mode javascript?

I use ReturnOfSmartPart on WSS3 to display a ASCX in Sharepoint as a web part. This works beautifully.

The only problem is that the AjaxSmartPart seems to be using the Debug mode javascript (the scripts are close to 1MB!)

How can I ensure that the AjaxSmartPart only uses the "Release" mode java scripts?

Note:

  • I have Published my ASCX in Release mode.
  • Debug="false" in my Sharepoint web.config
From stackoverflow
  • Simple, set your web.config Debug mode to false. This should already work.

    If you wish to override the behaviour, put the following code in your OnPreRender method of your ASCX...

    protected override void OnInit(EventArgs e)
    {
        ScriptManager sm = ScriptManager.GetCurrent(this.Page);
        sm.ScriptMode = ScriptMode.Release;
    
        base.OnInit(e);
    }
    

0 comments:

Post a Comment