0

I have the following code, which is working in ASPX file correctly, but in HTML Master page it is not working, please help me.

<!--MS:<SharePoint:AjaxDelta id="DeltaTopNavigation1" BlockElement="true" CssClass="ms-displayInline ms-core-navigation" role="navigation" runat="server">-->
                            <!--MS:<SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="topNavigationDelegate1" AllowMultipleControls="True">--><!--ME:</SharePoint:DelegateControl>-->
                            <div>
                                <nav id="SpNav">
                                    <ul id="SpNavUL">
                                        <!--MS:<asp:Repeater runat="server" ID="MenuRepeater" DataSourceID="topSiteMap1">-->
                                            <!--MS:<ItemTemplate>-->
                                                <li>

                                                <!--MS:<asp:LinkButton ID="lnkLink" runat="server" Text='<%# Eval("Title") %>' CommandArgument='<%# Eval("Url") %>'>--><!--ME:</asp:LinkButton>-->
                                                <!--MS:<asp:Repeater runat="server" ID="ChildMenuRepeater" DataSource="<%# ((SiteMapNode)Container.DataItem).ChildNodes %>">-->
                                                    <!--MS:<HeaderTemplate>-->
                                                        <ul id="SpNavChilds">
                                                    <!--ME:</HeaderTemplate>-->
                                                    <!--MS:<ItemTemplate>-->
                                                            <li><!--SPS:<asp:LinkButton ID="lnkLink" runat="server" Text='<%# Eval("Title") %>' CommandArgument='<%# Eval("Url") %>'>--><!--ME:</asp:LinkButton>--></li>
                                                    <!--ME:</ItemTemplate>-->
                                                    <!--MS:<FooterTemplate>-->
                                                        </ul>
                                                    <!--ME:</FooterTemplate>-->
                                                    <!--ME:</asp:Repeater>-->
                                                </li>
                                            <!--ME:</ItemTemplate>-->
                                        <!--ME:</asp:Repeater>-->
                                    </ul>
                                </nav>   
                                <!--MS:<asp:SiteMapDataSource ShowStartingNode="False" SiteMapProvider="CombinedNavSiteMapProvider" id="topSiteMap1" runat="server" StartingNodeUrl="sid:1002" />-->
                            </div>
                            <!--ME:</SharePoint:AjaxDelta>-->
2
  • 2
    Welcome to the SP.SE community! We would love to help you out with your question. Can you give us a few more details about your situation? What version of SharePoint is this? What is the code supposed to do and which aspx file are you referring to?
    – thanby
    Jan 15, 2014 at 15:05
  • Hi Robert, I am using SharePoint 2013, this code is for Global Menu, you know that in SharePoint 2013 we should work in HTML Master page. for simple asp.net page it is working, but when I want to convert it to HTML version then it is not working. Jan 16, 2014 at 4:13

2 Answers 2

1

your code looks like a mess ;) sorry! You cant do a straight conversion of aspx to html! when you load a page from aspx on a browser it gets converted in html: witin ie goto f12 developer tools and you can inspect the html generated from the aspx.... thats masterpage + layouts + everything else :)

are you trying just to get the divs navs and ul li to show up in sharepoint html page? I dont get why your trying to make a masterpage in html?

your missing the doc type, header/footer and body! its not like in asp.net! html needs to have those!

as a template you can follow this:

<!DOCTYPE html PUBLIC 
            "-//W3C//DTD XHTML 1.0 Transitional//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
      <title></title>

      <link rel="shortcut icon" 
            media="screen,print" 
            href="Images/favicon.ico" />

      <link type="text/css" 
            rel="Stylesheet" 
            media="screen,print" 
            href="CSS/GGGustafson.css" />

    </head>
    <body onload="add_header('PAGE LOGO',
                             'PAGE LOGO TARGET',
                             'PAGE HEADER',
                             'PAGE SUBHEADER');
                  add_footer('PAGE VALIDATION LOGO');">

      <div id="header">
      </div>

      <table class="content" 
             cellpadding="0" 
             cellspacing="0">
        <tr>
          <td class="left_column left_content">

          </td>

          <td class="center_column center_content">

          </td>

          <td class="right_column right_content">

          </td>
        </tr>
      </table>

      <div id="footer">
      </div>

      <script type="text/javascript" 
              defer="defer" 
              src="Scripts/place_in_outerHTML.js"></script>
      <script type="text/javascript" 
              defer="defer" 
              src="Scripts/IO.js"></script>
      <script type="text/javascript" 
              defer="defer" 
              src="Scripts/add_footer.js"></script>
      <script type="text/javascript" 
              defer="defer" 
              src="Scripts/add_header.js"></script>

    </body>
</html>

the above was taken from here, it explains in detail whats going on:

http://www.codeproject.com/Articles/114458/Master-Pages-using-HTML-and-JavaScript

1
  • Thanks to your replay, I want to have this Master page for SharePoint 2013, in SP2013 we must work in HTML file, not directly in .master file, this code is only for global menu. Jan 16, 2014 at 3:56
0

I don't have a solution to your problem, but I can narrow it down.

The issue is with : <%# Eval("Title") %>

If you remove these from your code it will work, but obviously won't have the links. I am attempting to solve the same problem at the moment.

Your Answer

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

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