4

I build an MVC application and I run it by linking a content editor webpart to the index.html file. That usually works fine but I'd like to build it into an aspx page and link to that page directly. Seems like a nicer way to deploy the solution.

I'm not too familiar with aspx but I've tried doing it based on some example I found online. However, I keep getting this error: Content controls have to be top-level controls in a content page or a nested master page that references a master page.

I put this together based on that above example. The @ifdev or @exclude are used for preprocessing resources for launch so implementing minified files and removing others, etc.

<%-- SPDASH PAGE --%>
<%@ Page language="C#" MasterPageFile="~masterurl/default.master"    Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
    <html lang="<%$Resources:wss,language_value%>" dir="<%$Resources:wss,multipages_direction_dir_value%>" runat="server" xmlns:o="urn:schemas-microsoft-com:office:office" __expr-val-dir="ltr">
        <head runat="server">
            <title>SPDash</title>
            <!-- Scripts -->    
            <!-- ENABLE ON SITES WHICH DO NOT CONTAIN SCRIPT LOADER / I actually don't remember how this works -->
            <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/labjs/2.0.3/LAB.min.js"></script> 
            <!-- @exclude -->
            <script type="text/javascript" src="/Style%20Library/projects/spDash/app/js/loader.js"></script>
            <!-- @endexclude -->
            <!-- @ifdef PRODUCTION -->
            <script type="text/javascript" src="/Style%20Library/projects/spDash/dist/js/loader.min.js"></script>
            <!-- @endif -->

            <!-- CDN RESOURCES -->
            <!-- Bootstrap -->
            <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">  
            <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">

            <!-- Selected 2 -->
            <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2/3.4.5/select2-bootstrap.css">
            <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2/3.4.5/select2-spinner.gif">
            <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2/3.4.5/select2.png">
            <!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2/3.4.5/select2.css"> -->
            <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2/3.4.5/select2.min.css"> 

            <!-- DataTables -->
            <link rel="stylesheet" type="text/css" href="https://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables_themeroller.css">
            <link type="text/css" rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/ui-darkness/jquery-ui.css"/>
            <link type="text/css" rel="stylesheet" href="https://cdn.datatables.net/fixedcolumns/3.0.0/css/dataTables.fixedColumns.min.css"/>
            <link type="text/css" rel="stylesheet" href="https://cdn.datatables.net/colvis/1.1.0/css/dataTables.colVis.min.css"/>
            <link type="text/css" rel="stylesheet" href="https://cdn.datatables.net/tabletools/2.2.0/css/dataTables.tableTools.min.css"/>

            <!-- Animations -->
            <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.0.0/animate.min.css">
            <!-- <link rel="stylesheet" type="text/css" href="/Style%20Library/projects/spDash/app/css/ngAnimate.css"> -->
            <!-- <link rel="stylesheet" type="text/css" href="/Style%20Library/projects/spDash/app/css/animate.css"> -->

            <!-- @exclude -->
            <!-- DEV RESOURCES -->
            <!-- General fixes -->
            <link rel="stylesheet" type="text/css" href="/Style%20Library/projects/spDash/app/css/fixes.css"/>
            <!-- Treeview Directive -->
            <link rel="stylesheet" href="/Style%20Library/projects/spDash/app/css/tree-control.css">
            <!-- Loading animation -->
            <link type="text/css" rel="stylesheet" href="/Style%20Library/projects/spDash/app/css/angular-busy.css"/>
            <!-- @endexclude -->

            <!-- @ifdef PRODUCTION -->
            <!-- PROD RESOURCES -->
            <link type="text/css" rel="stylesheet" href="/Style%20Library/projects/spDash/dist/css/app.min.css"/> 
            <!-- @endif -->
        </head>

        <asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">SPDashboard</asp:Content>
        <asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server"><h2>SPDash</h2></asp:Content>
        <asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
        <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
            <!--[if lt IE 9]>
                <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
            <![endif]-->
            <style type="text/css">
                body #s4-leftpanel {
                    display:none;
                }
                .s4-ca {
                    margin-left:0px;
                }
            </style>
        </asp:Content>

        <asp:Content ContentPlaceHolderId="PlaceHolderSearchArea" runat="server"></asp:Content>
        <asp:Content ContentPlaceHolderId="PlaceHolderLeftActions" runat="server"></asp:Content>
        <asp:Content ContentPlaceHolderId="PlaceHolderPageDescription" runat="server">SPDash for Portal Management</asp:Content>
        <asp:Content ContentPlaceHolderId="PlaceHolderBodyRightMargin" runat="server"></asp:Content>
        <asp:Content ContentPlaceHolderId="PlaceHolderPageImage" runat="server"></asp:Content>
        <asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server"></asp:Content>
        <asp:Content ContentPlaceHolderId="PlaceHolderNavSpacer" runat="server"></asp:Content>

        <body>
            <div id="mdContainer" class="mdContainer animated fadeInDown container-fluid" ng-cloak>
                <!-- Navigation --> 

                    <!-- @exclude -->
                    <div ng-include class="animated fadeInDown" src="'/Style%20Library/projects/spDash/app/partials/navigation.html'"></div>
                    <!-- @endexclude -->

                    <!-- @ifdef PRODUCTION -->
                    <div ng-include=" '/navigation.html' " class="animated fadeInDown"></div>
                    <!-- @endif -->     

                <!-- Main view --> 
                <ui-view></ui-view>
            </div>
        </body>
    </html>
</asp:Content>

Your Answer

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

Browse other questions tagged or ask your own question.