views:

2002

answers:

2

Hi there

So I have another noodle-scratcher (for me anyway).

I'm trying to create my own custom control in a CMS I only have partial source code for (i.e. samples the vendor has supplied to me). Basically I have created a class called DataDefinitionContent which extends ControlBase. Now, from what I can garner from the metadata, ControlBase extends UserControl, so I would have thought this would run without a drama. Can anyone shed any light on why this might not be working for me?


My Class:

public partial class DataDefinitionContent : ControlBase, ICustomControl<DataDefinition>
{
... Stuff
}

ControlBase:

using System;
using System.Web.UI;
namespace CMS.Web
{
    public class ControlBase : UserControl
    {
    ... Stuff
    }
}

My ascx file:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DataDefinitionContent.ascx.cs"
    Inherits="CMS.Admin.WebUI.CustomControls.DataDefinitionContent, CoA.Admin.WebUI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" %>

The error I'm getting:

Parser Error Message: 'CMS.Admin.WebUI.CustomControls.DataDefinitionContent, CoA.Admin.WebUI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not allowed here because it does not extend class 'System.Web.UI.UserControl'.

Line 1: <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DataDefinitionContent.ascx.cs"

+3  A: 

Try putting your partial class in

namespace CMS.Web
Jack Marchetti
Your suggestion worked, but I ended up approaching the problem from a different angle. Thanks for your help.
Iain Fraser
Cool man. What approach did you take? The whole namespace issue can become an utter nightmare if you ever convert a WebSite to Web Application.
Jack Marchetti
A: 

thank you thank you thank you!

and yeah, converting a site to app has been a nightmare! :)

andiwivs