Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

User control created is not running.

Vote:
 

Hi,

I have started to build a user control like this way.

Schedule.ascx file code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Tree.Templates.DynamicContent.Vpo
{
 
 
 
    public partial class Schedule : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
 
        }
    }
}

Schedule.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Schedule.ascx.cs" Inherits="Tree.Templates.DynamicContent.Vpo.Schedule" %>


And the code for rendering control like this


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using EPiServer;
using EPiServer.Core;
using EPiServer.DataAbstraction;
using EPiServer.DynamicContent;
using EPiServer.PlugIn;
using Tree.Templates.DynamicContent.Vpo;
 
 
namespace Tree.Templates.DynamicContent.Vpo
{
    [GuiPlugIn(
        Url = "~/Templates/DynamicContent/Schedule.ascx",
        Area = PlugInArea.DynamicContent
    )]
 
    public class ScheduleList : IDynamicContent
    {
        public static int instanceId = 0;
         
        
 
        public System.Web.UI.Control GetControl(EPiServer.PageBase hostPage)
        {
            /*Resets if reachec 10 to 0*/
            if (instanceId == 100)
                instanceId = 0;
 
            var userControl = hostPage.LoadControl("~/Templates/DynamicContent/Schedule.ascx");
            return userControl;
        }
 
        public EPiServer.Core.PropertyDataCollection Properties
        {
            get { throw new NotImplementedException(); }
        }
 
        public string Render(EPiServer.PageBase hostPage)
        {
 
            throw new NotImplementedException();
        }
 
        public bool RendersWithControl
        {
            get { return true; }
        }
 
        public string State
        {
            get;
            set;
        }
    }
}


and in the EPIServer.config section write dynamic config like this

dynamicContent>
    <controls>
      <add description="Displays a property from any page" name="PagePropertyPlugin" type="EPiServer.DynamicContent.PlugIn.DynamicPageProperty, EPiServer" />
      <add description="Schedule" name="Schedule" type="Tree.Templates.DynamicContent.Vpo.ScheduleList" />
    </controls>
  </dynamicContent>
but when i am runnig project it is giving error

The Dynamic Content control type Schedule could not be loaded. Check the <dynamicContent> section in web.config

What is the problem




#82840
Mar 20, 2014 11:22
Vote:
 

Did you get this to work yet? I can't really see much odd with your setup, but here is a shot. See if you can add your assembly name to the type attribute in your configuration. That would be something like:

<add description="Schedule" name="Schedule" type="Tree.Templates.DynamicContent.Vpo.ScheduleList, Tree" />

If your binary was called Tree.dll

EPiServer's DynamicPageProperty is in EPiServer.dll

<add description="Displays a property from any page" name="PagePropertyPlugin" type="EPiServer.DynamicContent.PlugIn.DynamicPageProperty, EPiServer" />

like so.

Hope it helps.

//Mathias

EDIT: Removed failed config paste.

#82954
Edited, Mar 22, 2014 0:26
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.