Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Controls collection cannot be modified ....Controls collection cannot be modified ....
Previous
 
Next
New Post
10/14/2011 12:36 AM
 
Experimenting with dynamic skins, I've created a skin which, based on browser loads a browser based skin (control).

It all appears to work but i am using try ..catch to load the browser based skin as a control and although it loads, it always throws an exception: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Checking for <% .. %> in the browser based skin, i have even stripped it down to just a content pane but i still get the same error. i think much of the issue is that both the main/redirect skin and the browser based skin seem to need the reference to <%@ Control ..... "skins.vb" ... > to function properly and to render the contentPane and other panes.

where is this error coming from?


redirect.ascx
<%@ Control language="vb" CodeBehind="~/admin/Skins/skin.vb" AutoEventWireup="false" Explicit="true" Inherits="DotNetNuke.UI.Skins.Skin" %>
<script runat="server">
   Protected Overrides Sub OnInit(ByVal e As System.EventArgs)
      dim device = Request.Browser.Browser.ToLower()

      if (device <> "")
         device = trim(Replace(device, Chr(13), ""))
      else
         device = "Blue_site"
      end if

      try
         Controls.Add(LoadControl("layouts/" + device + ".ascx"))
      catch ex as Exception
         Dim objEventLog As New DotNetNuke.Services.Log.EventLog.EventLogController
         objEventLog.AddLog("Mobile Page Load", ex.ToString, PortalSettings, -1, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT)
      end try

   End Sub
</script>

firefox.ascx
<%@ Control language="vb" CodeBehind="~/admin/Skins/skin.vb" AutoEventWireup="false" Explicit="true" Inherits="DotNetNuke.UI.Skins.Skin" %>
<%@ Register TagPrefix="dnn" TagName="LOGO" Src="~/Admin/Skins/Logo.ascx" %>
<%@ Register TagPrefix="dnn" TagName="BANNER" Src="~/Admin/Skins/Banner.ascx" %>
<%@ Register TagPrefix="dnn" TagName="MENU" Src="~/Admin/Skins/SolPartMenu.ascx" %>
<%@ Register TagPrefix="dnn" TagName="SEARCH" Src="~/Admin/Skins/Search.ascx" %>
<%@ Register TagPrefix="dnn" TagName="CURRENTDATE" Src="~/Admin/Skins/Currentdate.ascx" %>
<%@ Register TagPrefix="dnn" TagName="BREADCRUMB" Src="~/Admin/Skins/BreadCrumb.ascx" %>
<%@ Register TagPrefix="dnn" TagName="USER" Src="~/Admin/Skins/User.ascx" %>
<%@ Register TagPrefix="dnn" TagName="LOGIN" Src="~/Admin/Skins/Login.ascx" %>
<%@ Register TagPrefix="dnn" TagName="COPYRIGHT" Src="~/Admin/Skins/Copyright.ascx" %>
<%@ Register TagPrefix="dnn" TagName="TERMS" Src="~/Admin/Skins/Terms.ascx" %>
<%@ Register TagPrefix="dnn" TagName="PRIVACY" Src="~/Admin/Skins/Privacy.ascx" %>
<%@ Register TagPrefix="dnn" TagName="LINKS" Src="~/Admin/Skins/Links.ascx" %>
<%@ Register TagPrefix="dnn" TagName="CONTROLPANEL" Src="~/Admin/Skins/controlpanel.ascx" %>

<div class="pagemaster" >
     <div id="ControlPanelWrapper">
         <dnn:CONTROLPANEL runat="server" id="cp"  IsDockable="True" />
    </div>
    <div class="content">
        <div class="breadhold">
            <div class="breadpos">You are here: <dnn:BREADCRUMB runat="server" id="dnnBREADCRUMB" Separator="&nbsp;&raquo;&nbsp;" CssClass="breadlink" RootLevel="0" /></div>
        </div>
        <div class="maincontent">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td class="paneleft" id="LeftPane" runat="server" valign="top" align="left" visible="false" ></td>
            <td class="panecontent" id="ContentPane" runat="server" valign="top" align="left" ></td>
          </tr>
        </table>
        </div>
    </div>
</div>
 
New Post
10/14/2011 3:09 AM
 
please note that error can be slightly misleading - if you page has an exception when it loads and that exception is written out to the page then that can cause this issue i.e. the <% and %> may have nothing to do with it - and the issue could be in the codebehind page e.g. i see you're trying to use a core page and if that contains logic to ensure only admin/host users can access then that might be where the exception is thrown from. In this sort of case the best way to determine is to attach a debugger in vs.net and break on any issue

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Controls collection cannot be modified ....Controls collection cannot be modified ....


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out