More in this section

Forums / Developing with Sitefinity / System.ArgumentException: Type "ASP.modules (...) _ascx" cannot be resolved.

System.ArgumentException: Type "ASP.modules (...) _ascx" cannot be resolved.

6 posts, 0 answered
  1. mario
    mario avatar
    23 posts
    Registered:
    08 Aug 2011
    12 Dec 2011
    Link to this post
    Hello team,

    Im experimentig an issue since the last week.
    This custom module used to work fine, but doing some updates something got messed up
    and it throws the error described in the attached pic.

    can you tell me what's can be the problem?

    Thanks.
    -Mario Araya-
  2. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    14 Dec 2011
    Link to this post
    Hello Mario,

    I'm not sure how this happened. Do you have an embedded .ascx template in your custom control? If you send us the source for your control that would help us a lot.

    Regards,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. mario
    mario avatar
    23 posts
    Registered:
    08 Aug 2011
    14 Dec 2011
    Link to this post
    Thanks.

    Here i put some of the source. please tell me if there's something else needed.


    SystemConfig.config
    <
    applicationModules>
            ...
            <add title="Banner Slideshow" type="SitefinityWebApp.Modules.BannerMultiple.BannerMultipleModule" startupType="OnApplicationStart" version="4.2.1650.0" name="BannerSlideshow" />
        </applicationModules>


    BannerMultipleAdmin.ascx
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="BannerMultipleAdmin.ascx.cs" Inherits="SitefinityWebApp.Modules.BannerMultiple.BannerMultipleAdmin" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.Fields" TagPrefix="sf" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="telerik" %>
     
    <script src="/App_Themes/StGeorgeTheme/js/jquery-1.6.2.min.js" type="text/javascript"></script>
    <script src="/Modules/BannerMultiple/colorbox/jquery.colorbox-min.js" type="text/javascript"></script>
    <link href="/Modules/BannerMultiple/colorbox/colorbox.css" rel="stylesheet" type="text/css" />
    <link href="/App_Themes/StGeorgeTheme/CSS/moduloBannerMultiple.css" rel="stylesheet" type="text/css" />
     
        <script type="text/javascript">
     
            var radio;
            var checkbox;
            var txtLinkId;
            function targetChanged(sender) {
                radio = $(sender);
                if (radio.children().val() == "radioLbox")
                    radio.parent().next().show();
                else
                    radio.parent().next().hide();
            }
     
            function sinLinkClicked(sender) {
                 
                checkbox = $(sender).children(":first-child");
                 
                if (checkbox.is(':checked')) {
                    checkbox.parent().parent().children("input").val("");
                    checkbox.parent().parent().children("input").attr("disabled", true);
                    checkbox.parent().parent().next().next().next().hide();
                    checkbox.parent().parent().next().next().hide();
                    checkbox.parent().parent().next().hide();
                }
                else {
                    checkbox.parent().parent().children("input").removeAttr("disabled");
                    checkbox.parent().parent().next().next().next().show();
                    checkbox.parent().parent().next().next().show();
                    checkbox.parent().parent().next().show();
     
                    //radioButtons
                    $("input:radio:checked").each(function () {
                        targetChanged($(this).parent());
                    });
                }
            }
     
            function urlPop(url, w, h) {
                window.top.$.colorbox({ href: url, width: '' + w + 'px', height: '' + h + 'px', iframe: true });
            }
     
            function muestraArbol(textbox) {
                txtLinkId = $(textbox).attr('Id');
                urlPop('/Modules/BannerMultiple/muestraArbolPaginas.aspx', '640', '480');
            }
     
            $(document).ready(function () {
                $("input:checkbox:checked").each(function () {
                    sinLinkClicked($(this).parent());
                });
     
                $(".checkSinLink").click(function () {
                    sinLinkClicked($(this));
                })
     
                $(".radioTarget").click(function () {
                    targetChanged($(this));
                })
            });
     
        </script>
     
     
    <h1 class="sfBreadCrumb">
        Banner Slideshow
    </h1>
     
    <telerik:RadWindowManager ID="RadWindowMgr" runat="server" EnableShadow="true"></telerik:RadWindowManager>
    <sitefinity:formManager id="formmanager" runat="server" />
     
    <div class="sfMain sfClearfix">
        <div class="sfMain sfClearfix">
            <div class="sfAllToolsWrapper">
                <div class="sfAllTools">
                    <div class="sfActions">
                        <!-- Toolbox -->
                        <ul>
                            <li class="sfMainAction">
                            </li>
                        </ul>
     
                    </div>
                </div>
            </div>
                   
            <div class="sfWorkArea sfClearfix">
            <div class="sfForm sfExpandedForm sfFirstForm" style="width:50%;margin: 0 auto;">
            <div class="sfFormIn">
                         
                <div class="rgTopOffset">
                    <!-- Workspace -->   
                    <br />
                    <div>
                        <telerik:RadAsyncUpload runat="server" ID="AsyncUpload1" TargetFolder="~/Modules/BannerMultiple/Imagenes/"
                            MultipleFileSelection="Automatic" AllowedFileExtensions="jpeg,jpg,gif,png">
                                <Localization Select="Seleccionar" />
                        </telerik:RadAsyncUpload>
                    </div>
                    <div>
                        <asp:LinkButton class="sfLinkBtn sfSave" ID="LinkButton1" runat="server" onclick="btnSubirFotos_Click">
                            <strong class="sfLinkBtnIn">Subir Fotos</strong>
                        </asp:LinkButton>
                    </div>
                    <br /><br />
                    <div class="moduloBanner">                  
                         
                        <asp:Repeater ID="repeaterImagenes" runat="server">
                            <ItemTemplate>
                                <div class="label">Imagen</div>
                                <div><telerik:RadTextBox ID="imgName" Width="80%" runat="server" ReadOnly="true"></telerik:RadTextBox></div>
     
                                <div class="label">Link</div>
                                <div class="link RadInput RadInput_Default">
                                    <asp:TextBox Width="80%" onclick="muestraArbol(this);" ID="txtLink" runat="server" class="riTextBox riRead"/>
                                    <asp:CheckBox ID="checkSinLink" class="checkSinLink" Text="Sin link" runat="server" Checked="true" />
                                </div>
     
                                <div class="label">Abrir link</div>
                                <div>
                                    <asp:RadioButton ID="radioSelf" class="radioTarget" Text="En la misma ventana" GroupName="linkTarget" runat="server" Checked="true" />    
                                    <asp:RadioButton ID="radioBlank" class="radioTarget" Text="En una nueva ventana" GroupName="linkTarget" runat="server"  />    
                                    <asp:RadioButton ID="radioLbox" class="radioTarget" Text="En un lightbox" GroupName="linkTarget" runat="server" />    
                                </div>
                                 
                                <div id="size_lightbox" runat="server" class="size_lightbox">
                                    <div class="label">Tamaño del lightbox</div>
                                    <div class="divIzq">Ancho:<telerik:RadNumericTextBox ID="lboxWidth" Width="30px" MaxLength="4" MaxValue="1920" runat="server">
                                       <NumberFormat AllowRounding="false" KeepNotRoundedValue="true" DecimalDigits="0" />
                                    </telerik:RadNumericTextBox>px</div>
                                    <div class="divDer">Alto:<telerik:RadNumericTextBox ID="lboxHeight" Width="30px" MaxLength="4" MaxValue="1080" runat="server">
                                        <NumberFormat DecimalDigits="0" />
                                    </telerik:RadNumericTextBox>px</div>
                                </div>
                                <div class="label sfFormSeparator" style="display:block"></div>
                            </ItemTemplate>
                        </asp:Repeater>
     
                        <br />
                        <asp:LinkButton class="sfLinkBtn sfSave" ID="btnGuardarBanner" runat="server" onclick="btnGuardarBanner_Click">
                            <strong class="sfLinkBtnIn">Guardar Banner</strong>
                        </asp:LinkButton>
                        <a href="<%= ResolveUrl(Telerik.Sitefinity.Web.SiteMapBase.GetActualCurrentNode().ParentNode.Url)%>">   Cancelar</a>
                    </div>
                </div>
             
            </div>
            </div>
            </div>
        </div>
    </div>


    BannerMultipleAdmin.ascx.cs
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.Web.UI;
    using System.Web.UI.HtmlControls;
    using SitefinityWebApp.Data;
     
    namespace SitefinityWebApp.Modules.BannerMultiple
    {
        public partial class BannerMultipleAdmin : System.Web.UI.UserControl
        {
            StGeorgeEntities context = new StGeorgeEntities();
     
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                    CargarDesdeBD();
            }       

            /// <summary>
            /// Carga data desde BBDD si existe
            /// </summary>
            private void CargarDesdeBD()
            {
                int nImagenesBD = context.BannerMultiples.Count();
                if (nImagenesBD < 1)
                    return;
     
                CrearRepeaterImagenes(nImagenesBD);
     
                int i = 0;
                foreach (var banner in context.BannerMultiples.ToList())
                {
                    if (banner.LinkUrl.IsNullOrEmpty())
                        ((CheckBox)repeaterImagenes.Controls[i].FindControl("checkSinLink")).Checked = true;
     
                    ((RadTextBox)repeaterImagenes.Controls[i].FindControl("imgName")).Text = banner.ImgPath;
                    ((TextBox)repeaterImagenes.Controls[i].FindControl("txtLink")).Text = banner.LinkUrl;
                    CheckRadioTarget(i, banner.LinkTarget);
                    ((RadNumericTextBox)repeaterImagenes.Controls[i].FindControl("lboxWidth")).Text = banner.lboxWidth.ToString();
                    ((RadNumericTextBox)repeaterImagenes.Controls[i].FindControl("lboxHeight")).Text = banner.lboxHeight.ToString();
                    i++;
                }
            }
     
            private string GetRadioTarget(int indexRepeater)
            {
                if (((RadioButton)repeaterImagenes.Controls[indexRepeater].FindControl("radioSelf")).Checked)
                    return "En la misma ventana";
     
                else if (((RadioButton)repeaterImagenes.Controls[indexRepeater].FindControl("radioBlank")).Checked)
                    return "En una nueva ventana";
     
                else if (((RadioButton)repeaterImagenes.Controls[indexRepeater].FindControl("radioLbox")).Checked)
                    return "En un lightbox";
     
                return "";
            }
     
            private void CheckRadioTarget(int indexRepeater, string valor)
            {
                ((HtmlControl)repeaterImagenes.Controls[indexRepeater].FindControl("size_lightbox")).Style.Add("display", "none");
     
                if (valor == "En la misma ventana")
                    ((RadioButton)repeaterImagenes.Controls[indexRepeater].FindControl("radioSelf")).Checked = true;
     
                else if (valor == "En una nueva ventana")
                    ((RadioButton)repeaterImagenes.Controls[indexRepeater].FindControl("radioBlank")).Checked = true;
     
                else if (valor == "En un lightbox")
                {
                    ((RadioButton)repeaterImagenes.Controls[indexRepeater].FindControl("radioLbox")).Checked = true;
     
                    //muestra DIV_TAMAÑO_LIGHTBOX
                    ((HtmlControl)repeaterImagenes.Controls[indexRepeater].FindControl("size_lightbox")).Style.Add("display", "block");
                }
            }
     
            private void RemoverDataBanner()
            {
                foreach (var item in context.BannerMultiples)
                {
                    context.BannerMultiples.DeleteObject(item);
                }
            }
        }
    }
  4. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    19 Dec 2011
    Link to this post
    Hi Mario,

    I see you have an .ascx template. Is it marked as an EmbeddedResource in your project? Do you use a proper virtual path setting pointing the the assembly where your module is defined? It looks like the error is happening because Sitefinity can't find the .ascx template when rendering the module.

    Regards,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. mario
    mario avatar
    23 posts
    Registered:
    08 Aug 2011
    20 Dec 2011
    Link to this post
    Hi Lubomir, thanks for answer

    but none of my module's .ascx is defined as "EmbeddedResource" in visual studio and all work fine except this one :( .... also, the virtual path that i have defined i don't use it in the modules, because all are in the same web project.

    this behavior happens only in a pre-production server not in my local machine. the .config files are the same

    Please help.

    -Thanks-
    Mario
  6. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    22 Dec 2011
    Link to this post
    Hi Mario,

    I would really need your entire module project? You can open a support ticket and attach the project there, since these are our forums.

    Greetings,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
6 posts, 0 answered