locked
Designer tags __designer:Preview="<span> How to disable? RRS feed

  • Question

  • I have tried to find a way to disable the designer tags that SPD 2013 adds to the markup in master-pages and page-layouts.

    The code gets messed up and almost impossible to read.

    Do these tags __designer:Preview="<span>... have a purpose? 

    I would really like to know how to disable these tags and if that is not possible a reason why it is not possible.

    Regards

    Gustav Corne

    Wednesday, December 3, 2014 4:25 PM

Answers

  • Hi Gustav,

    I understand you would like to know how the tag __designer:Preview is generated in master page.

    Please understand this is by design behavior in SharePoint Designer's design. SharePoint Designer adds __designer:Values and __designer:Preview attributes to controls on a Master after adding a HTML comments around said control.

    One method to deal with this is to use an Asp:Panel instead of a HTML comment. The Asp:Panel will prevent the markup from ever being generated and in turn lightening the load on the network.

    Once you insert <SharePoint:CssLink runat="server"/>, it will look like the code below after the encoding happens:

    <!--<SharePoint:CssLink runat="server" __designer:Preview="&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/_layouts/1033/styles/core.css&quot;/&gt;
    " __designer:Values="&lt;P N='InDesign' T='False' /&gt;&lt;P N='ID' T='ctl01' /&gt;&lt;P N='Page' ID='1' /&gt;&lt;P N='TemplateControl' ID='2' /&gt;&lt;P N='AppRelativeTemplateSourceDirectory' R='-1' /&gt;"/>-->

    Once the page renders, it will turn into another looking in the HTML source of the page. Indeed, the problem with HTML comments is the readability of the MasterPage's markup is reduced. Here is an example of how to configure the Asp:Panel instead of HTML comments:

    <asp:Panel runat="server" Visible="false"><SharePoint:CssLink runat="server"/></asp:Panel>

    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.panel(v=vs.110).aspx

    Regards,

    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com .


    Rebecca Tu
    TechNet Community Support

    • Marked as answer by Rebecca Tu Sunday, December 14, 2014 7:37 AM
    Friday, December 5, 2014 3:05 AM

All replies

  • Hi Gustav,

    There might format mistake in the code you used to load custom CSS file in master page.

    http://vyeung.wordpress.com/2011/06/01/sharepoint-designer-2010-addinggenerating-__designer-preview-tags-a-fix-to-solve-this-issue/

    Please use SharePoint:CssRegistration to load CSS file and SharePoint:ScriptLink to load JS file. You could refer more samples via:

    http://www.ashokraja.me/post/Refer-Scripts-and-CSS-Style-Sheet-in-SharePoint-2013-Visual-Web-Part-and-Master-Page.aspx

    https://sgryphon.wordpress.com/2014/05/16/ways-to-load-jquery-in-sharepoint-20102013/

    Regards,

    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com .


    Rebecca Tu
    TechNet Community Support

    Thursday, December 4, 2014 7:49 AM
  • Thanks for the reply but that is not really what I wondered.

    If I cannot stop SPD from generating the tags, what is the point of adding them?

    Can the tags be used for anything?.

    Thursday, December 4, 2014 8:15 AM
  • Hi Gustav,

    I understand you would like to know how the tag __designer:Preview is generated in master page.

    Please understand this is by design behavior in SharePoint Designer's design. SharePoint Designer adds __designer:Values and __designer:Preview attributes to controls on a Master after adding a HTML comments around said control.

    One method to deal with this is to use an Asp:Panel instead of a HTML comment. The Asp:Panel will prevent the markup from ever being generated and in turn lightening the load on the network.

    Once you insert <SharePoint:CssLink runat="server"/>, it will look like the code below after the encoding happens:

    <!--<SharePoint:CssLink runat="server" __designer:Preview="&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/_layouts/1033/styles/core.css&quot;/&gt;
    " __designer:Values="&lt;P N='InDesign' T='False' /&gt;&lt;P N='ID' T='ctl01' /&gt;&lt;P N='Page' ID='1' /&gt;&lt;P N='TemplateControl' ID='2' /&gt;&lt;P N='AppRelativeTemplateSourceDirectory' R='-1' /&gt;"/>-->

    Once the page renders, it will turn into another looking in the HTML source of the page. Indeed, the problem with HTML comments is the readability of the MasterPage's markup is reduced. Here is an example of how to configure the Asp:Panel instead of HTML comments:

    <asp:Panel runat="server" Visible="false"><SharePoint:CssLink runat="server"/></asp:Panel>

    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.panel(v=vs.110).aspx

    Regards,

    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com .


    Rebecca Tu
    TechNet Community Support

    • Marked as answer by Rebecca Tu Sunday, December 14, 2014 7:37 AM
    Friday, December 5, 2014 3:05 AM
  • Gustav,

    I have found the __designer: attributes are not needed and can be removed once SPD adds them. A pain I know, but that is SharePoint. I too have found no way to disable them from being added in the first place.

    I have found that once I delete them from a specific tag, they normally do not get added back.


    Eric Overfield - PixelMill - ericoverfield.com - @EricOverfield

    Monday, December 15, 2014 6:32 AM