Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tom 28 posts 48 karma points
    Aug 20, 2013 @ 09:32
    Tom
    0

    Error creating control when publishing a form

    Hey guys. My third question in one day!

    I've created an .ascx file called GradCamp, referenced it with a macro called Form - Grad Camp, linked that to a template called Grad Camp and attempted to pull that template into a user control page called Grad camp registration.

    I'm getting an error on the page when I publish it:

    Error creating control (/usercontrols/Forms/GradCamp.ascx).
    Maybe file doesn't exists or the usercontrol has a cache directive, which is not allowed! See the tracestack for more information!

    The tracestack spits this out:

    System.Web.HttpParseException: Could not load type 'CampQuality.Web.usercontrols.Forms.GradCamp'. ---> System.Web.HttpParseException: Could not load type 'CampQuality.Web.usercontrols.Forms.GradCamp'. ---> System.Web.HttpException: Could not load type 'CampQuality.Web.usercontrols.Forms.GradCamp'. at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError) at System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly) at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ProcessException(Exception ex) at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath) at System.Web.UI.TemplateParser.ParseInternal() at System.Web.UI.TemplateParser.Parse() at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType() at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider) at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) at umbraco.developer.assemblyBrowser.Page_Load(Object sender, EventArgs e) in d:\TeamCity\buildAgent\work\7380c184e9fcd3ea\umbraco\presentation\umbraco\developer\Macros\assemblyBrowser.aspx.cs:line 3

     

    Anyone who can offer help gets my undying appreciation....

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Aug 20, 2013 @ 09:56
    Ismail Mayat
    0

    Tom,

    Two things firstly is the control definately present in the directory /usercontrols/ secondly the codebehind for the form which I assume is compiled into a dll is that dll present in the bin directory?

    Regards

    Ismail

  • Tom 28 posts 48 karma points
    Aug 21, 2013 @ 03:46
    Tom
    0

    Hi Ismail

    To be frank, I'm very new to both .NET and Umbraco. I saw in Umbraco's interface there was no easy way of creating a form, so decided to chance it with the .NET source files. I copied the code for a similar form - a contact form - and customised accordingly.

    The contact form had this at the start of the code, which I'm guessing is just a series of include calls to various files needed in the form:

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ContactUs.ascx.cs" Inherits="CampQuality.Web.usercontrols.Forms.ContactUs" %>
    <%@ Register src="Common/Name.ascx" tagname="Name" tagprefix="uc1" %>
    <%@ Register src="Common/EmailAddress.ascx" tagname="EmailAddress" tagprefix="uc2" %>
    <%@ Register src="Common/LocalCQ.ascx" tagname="LocalCQ" tagprefix="uc3" %>
    <%@ Register src="Common/CampQualityInformed.ascx" tagname="CampQualityInformed" tagprefix="uc4" %>
    <%@ Register src="Common/ContactDetails.ascx" tagname="ContactDetails" tagprefix="uc5" %>
    <%@ Register Src="Common/RequiredFields.ascx" TagName="RequiredFields" TagPrefix="uc6" %>
    <%@ Register Assembly="CampQuality.Web" Namespace="CampQuality.Web.usercontrols.Forms.Common" TagPrefix="CQ" %>

    Then I set up my Grad Camp form's header info like this:

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="GradCamp.ascx.cs" Inherits="CampQuality.Web.usercontrols.Forms.GradCamp" %>
    <%@ Register src="Common/Name.ascx" tagname="Name" tagprefix="uc1" %>
    <%-- Register src="Common/EmailAddress.ascx" tagname="EmailAddress" tagprefix="uc2" --%>
    <%@ Register src="Common/LocalCQ.ascx" tagname="LocalCQ" tagprefix="uc3" %>
    <%@ Register src="Common/CampQualityInformed.ascx" tagname="CampQualityInformed" tagprefix="uc4" %>
    <%@ Register src="Common/ContactDetails.ascx" tagname="ContactDetails" tagprefix="uc5" %>
    <%@ Register Src="Common/RequiredFields.ascx" TagName="RequiredFields" TagPrefix="uc6" %>
    <%@ Register Assembly="CampQuality.Web" Namespace="CampQuality.Web.usercontrols.Forms.Common" TagPrefix="CQ" %>

    As you can see I commented out the email field, as it wasn't needed. However I figured I was going to get into trouble with line 1: I don't know what the CodeBehind attribute does, and while I understand the concept of inheritance, I'm not really sure what I need to do with that Inherits attribute. I've saved this GradCamp file in the usercontrols directory - what else should I do? And can I happily get rid of that CodeBehind attribute?

     

    Cheers.

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Aug 21, 2013 @ 09:46
    Ismail Mayat
    0

    Tom,

    When working with forms in Umbraco the best thing todo is purchase contour for E99 its very easy to use extremely flexible and you has loads of hooks. See http://umbraco.com/products/more-add-ons/contour.aspx for more details you can install full working version that will work on localhost if you want to evaluate first.

    With regards to your query the way this is built is that the control / controls will refer to codebehind file that has logic this codebehind file is built into a dll and that dll lives in the bin. If that dll is missing then the usercontrol will try to reference the codebehind code but cannot. So you cannot just take it out. Also in the usercontrols directory do you have Common directory with all the other controls present?

    If you are new to all this contour will make your life a lot easier ;-}

    Regards

    Ismail

  • Tom 28 posts 48 karma points
    Aug 27, 2013 @ 01:46
    Tom
    0

    Hi Ismail, and thanks for the info. I guess the trouble is I just don't know how to set up the .dll file that the codebehind references. As I say, I pretty much copied the code from an existing form, then renamed accordingly. How was the .dll file for that form set up, I wonder? 

    I'm trying to download Contour but our install of Umbraco is pretty ancient, v4.0.4.2. So I need to use Contour v1.1.9. I've downloaded it but it's a free version - is this the right version, or do I need to purchase this older version somewhere? Not only that, once I've downloaded it I can't install it - I get a "Server error in '/' application" message. 

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Aug 27, 2013 @ 08:27
    Ismail Mayat
    0

    Tom,

    I would look at where you got the source code from. There should be a visual studio project /solution file in there you can then open that in visual studio and build that to get a dll or if your lucky the dll should already be there. With regards to contour if you look at the pdf documenation there is a section in there about doing a manual install if the installer fails.

    You will need to purchase license else it will only save to db when working localhost. Contact Umbraco for older license.

    Regards

    Ismail

Please Sign in or register to post replies

Write your reply to:

Draft