More in this section

Forums / Developing with Sitefinity / error in editing master page.

error in editing master page.

2 posts, 0 answered
  1. Zeeshan fawad
    Zeeshan fawad avatar
    4 posts
    Registered:
    05 Jun 2009
    08 Oct 2009
    Link to this post
    I'm doing the porting from exsisting asp.net website where in a masterpage is used relative paths for SSL and Non SSL pages and eg

    for  links of NonSSL page
    <

    a href='<%= root & "Default.aspx" %>'> and
    for links of SSL page

     

    href

    ='<%= roots & "personalized/download.aspx" %>'

     

    for css
    <

    link rel="stylesheet" href="<%=rootimg & "newstyles.css"%>" type="text/css" >

     

     

    and for images

     

    <

    img src='<%= rootimg & "images/top-bar1a.gif"%>'
    So when this master page is converted to sitefinity masterpage , it give me the following  error when a child pages is associated with it.
    The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
    Please guide me how to handle it.
    Regards
    Zeeshan Fawad

     

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    09 Oct 2009
    Link to this post
    Hi Zeeshan fawad,

    You could try using js in the body of the master page to add links.

    Sample:

    <%@ Master Language="C#" %>
    <%@ Register TagPrefix="ss" Assembly="Telerik.Search" Namespace="Telerik.Search.WebControls"%>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <script runat="server">
        protected string root = "http://www.google.com/";
    </script>
     
    <head runat="server">
        <title></title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />    
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <div id="wrapper">
            <div id="Header">
                <h1>My Organization</h1>
                <div id="TopNavigation">
                    <asp:contentplaceholder id="TopMenu" runat="server"></asp:contentplaceholder>           
                </div>
            </div>
            <div id="Main"><asp:contentplaceholder id="Content" runat="server"></asp:contentplaceholder></div>
            <div id="SideBar"><asp:contentplaceholder id="SideBarContent" runat="server"></asp:contentplaceholder></div>   
            <div id="Footer">2006-2007 © MyOrganization. All rights reserved </div>
           </div>
       </form>
     
    <script type="text/javascript">
        document.getElementById('mylink').href = '<%= root & "Default.aspx" %>';
    </script>
     
    </body>
    </html>


    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered