Ok I'm slightly confused! I created a usercontrol earlier and it wouldn't work - So I created a completely blank one as below
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="test.ascx.cs" Inherits="Umbraco_Usercontrols.test" %>
Code behind
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Umbraco_Usercontrols
{
public partial class test : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("Testing");
}
}
}
And when I try to use it as a macro I just get the following????
System.Web.HttpParseException: Could not load type 'Umbraco_Usercontrols.test'. ---> System.Web.HttpParseException: Could not load type 'Umbraco_Usercontrols.test'. ---> System.Web.HttpException: Could not load type 'Umbraco_Usercontrols.test'. 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.ParseReader(StreamReader reader, VirtualPath virtualPath) 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.UI.TemplateParser.Parse(ICollection referencedAssemblies, VirtualPath virtualPath) 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.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) at System.Web.UI.TemplateControl.LoadControl(String virtualPath) at umbraco.developer.assemblyBrowser.Page_Load(Object sender, EventArgs e)
Hey Sebastiaan - Yep did the usual stuff! Now what is weird is I created this usercontrol in VS2010 Beta1 - I just recreated the exact same UC in VS2008 and it works. Only difference in the files is as shown
CodeBehind="test.ascx.cs"
VS2008 File
CodeFile="test.ascx.cs"
I created the VS2008 one as a web site and not a project so that might be the reason why - Apart from that... I really don't know? Probably me being a dick :)
Hmm, well the codebehind file should be ignored anyway (it should use the inherits directive instead), are you sure that you targeted the 2010 version to .net 3.5? That might help.
Right I'm Stupid! Can't Get Usercontrol To Work?
Ok I'm slightly confused! I created a usercontrol earlier and it wouldn't work - So I created a completely blank one as below
Code behind
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace Umbraco_Usercontrols { public partial class test : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { Response.Write("Testing"); } } }And when I try to use it as a macro I just get the following????
System.Web.HttpParseException: Could not load type 'Umbraco_Usercontrols.test'. ---> System.Web.HttpParseException: Could not load type 'Umbraco_Usercontrols.test'. ---> System.Web.HttpException: Could not load type 'Umbraco_Usercontrols.test'. 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.ParseReader(StreamReader reader, VirtualPath virtualPath) 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.UI.TemplateParser.Parse(ICollection referencedAssemblies, VirtualPath virtualPath) 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.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) at System.Web.UI.TemplateControl.LoadControl(String virtualPath) at umbraco.developer.assemblyBrowser.Page_Load(Object sender, EventArgs e)Any ideas? I'm a touch miffed...!
This might be a bit too obvious, but did you copy the dll file to your bin folder?
Hey Sebastiaan - Yep did the usual stuff! Now what is weird is I created this usercontrol in VS2010 Beta1 - I just recreated the exact same UC in VS2008 and it works. Only difference in the files is as shown
VS2008 File
I created the VS2008 one as a web site and not a project so that might be the reason why - Apart from that... I really don't know? Probably me being a dick :)
Thanks for the reply
Hmm, well the codebehind file should be ignored anyway (it should use the inherits directive instead), are you sure that you targeted the 2010 version to .net 3.5? That might help.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.