More in this section

Forums / Developing with Sitefinity / Unable to add new user controls

Unable to add new user controls

4 posts, 0 answered
  1. Stuart
    Stuart avatar
    2 posts
    Registered:
    26 May 2009
    11 Jun 2010
    Link to this post
    Hi;

    I have previously had success with creating and uploading new user controls to my Sitefinity installation, however this has now stopped working.  Previously loaded user controls continue to work, but new or updated ones fail.

    When attempting to upload a completely new control, an error message regarding adding the control reference to the web.config is returned.  This can be prevented by manually editing the web.config and uploading the changed file.

    When updating existing user controls, the upload appears to proceed as expected, however when the updated control is added ot the page, the following error is reported:

     

    Server Error in '/' Application.

    Parser Error

    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

    Parser Error Message: Could not load type 'Controls_CateringStep1'.

    Source Error:

    Line 1: <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CateringStep1.ascx.cs" Inherits="Controls_CateringStep1" %>Line 2:  <!-- Column 1 start -->
    Line 3:  <h2>Having a meeting, party or conference? Spudbar catering is the perfect choice.</h2>

    Source File: /UserControls/Spudbar/CateringStep1.ascx    Line: 1

    Can you let me know what may be causing this and how to fix?

    Thanks,

    Stuart Roberts,
    spudbar.com.au

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    11 Jun 2010
    Link to this post
    Hello Stuart,

    It looks like the problem comes from the control itself.  The value of the CodeBehind or Inherit attribute is not correct and it does not reflect to the class definition in the code behind.
    Basically the Inherits attribute is construct based on the control location

    If the file is located in folder called CustomControl then the attribute will looks like Inherits="CustomControls_NameOfTheControl" and in the code behind you will have

    public partial class CustomControls_NameOfTheControl: System.Web.UI.UserControl

    In your case the value of the Inherits attribute is Inherits="Controls_CateringStep1" and the control is located under /UserControls/Spudbar/ . So make sure that all attributes have the proper values and the class definition is the same as this one for Inherits attribute.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Stuart
    Stuart avatar
    2 posts
    Registered:
    26 May 2009
    11 Jun 2010
    Link to this post
    Hi Ivan;

    A good starting point but I had checked that before resorting to posting here.  The class names etc all match up as expected, and when compiled on my workstation, everything compiles fine, so unfortunately not the solution this time.

    I am still pretty green in Sitefinity development.  Could you give me some more information on what Sitefinity does when a user control is uploaded this way?  Or when it is subsequently included on a page?  Is there some "compile" event triggered by Sitefinity at any stage that would create a compiled class file?

    Thanks for your time.

    Stuart Roberts
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    11 Jun 2010
    Link to this post
    Hello Stuart,

    There is no compilation. We just upload the control to a given folder and thats it.  By default the folder is "UserControls" and it is automatically created. We do not alter any part of the control or its code.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Register for webinar
4 posts, 0 answered