0

I'm trying to create a master page on SharePoint 2019 using the Design Manager (and so, using the automatic HTML -> MASTER conversion).

I am trying to use an asp:Repeater tag to loop over a SiteMapDataSource which works - the issue is trying to access properties of the item, example:

<%# Eval("Title") %>

tag will not wrap in a <!--MS: --> tag, and errors out - it will not convert to a master page.

Full example:

<ul class="navbar-nav justify-content-center w-100">
    <!--MS:<asp:Repeater runat="server" ID="TopNavMenu" DataSourceID="topSiteMap">-->
        <!--MS:<ItemTemplate>-->
            <li class="nav-item">
                <a class="nav-link"><!--MS:<%# Eval("Title") %>--></a>
            </li>
        <!--ME:</ItemTemplate>-->
    <!--ME:</asp:Repeater>-->
    <!--MS:<asp:SiteMapDataSource ShowStartingNode="False" SiteMapProvider="CombinedNavSiteMapProvider" id="topSiteMap" runat="server"/> -->
</ul>

Attempts tried:

#1 When wrapping Eval in

<!--MS: -->

the error is:

SharePoint can't parse this file, most likely because of an incorrectly formatted SharePoint snippet. The markup at the following location is causing problems. Edit the markup manually to fix it, or replace it with a new snippet from the Snippet Gallery. Invalid SharePoint markup at line #. Please repair or recreate the markup

#2 Without wrapping the Eval in

<!--MS: -->

the master page fails to compile.

#3 Trying to encode it as wrapping the Eval in:

&lt;!--MS: --&gt;

the master page works but it literally displays the code instead of rendering it

Is there anyway to make this work? Or can I use another tag other than Eval in the repeater? Or do I need to bypass the HTML conversion and just work on a master page directly? Thanks!

0

If you are comfortable with working on the master pages directly, and if you can make the repeater work in that fashion, I would suggest just doing that. The whole HTML conversion process is janky, error-prone, and unnecessary.

Same goes for page layouts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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