5

I have a feature which specifies a custom user control to be added to the AdditionalPageHead delegate control as such:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Control Id="AdditionalPageHead"
        Sequence="90"
        ControlSrc="~/_CONTROLTEMPLATES/15/CustomUserControl.ascx" /> 
</Elements>

The custom user control itself just adds a script block to the page.

When this feature is activated, MDS is disabled on the site collection.

I have set [assembly: MdsCompliant(true)] in the AssemblyInfo.cs and also added the attribute to the control.

[MdsCompliant(true)]
public partial class CustomUserControl : UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
}

It looks like I may need to set SPContext.Current.Web.EnableMinimalDownload but I'm not sure where that needs to be done.

What else do I need to do to make sure activating this feature won't disable MDS?

2
  • 1
    Are you overriding the render method? This is the only time I have seen this pattern disable MDS on the page load.
    – Hugh Wood
    Apr 17, 2013 at 16:56
  • Did you ever get this working? Thanks! Jun 11, 2013 at 16:52

1 Answer 1

1

I've written a blog post on a few gotcha's when working with MDS

http://steve.thelineberrys.com/gotchas-using-custom-web-parts-and-the-minimal-download-strategy/

My guess is that your user control will need a code behind on it and use the SPPageContentManager to register your script in addition to the mdscompliant(true) attribute.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.