The Dreaded “Not a Known Element” Error

Element ‘{name}’ is not a known element.  This can occur if there is a compilation error in the Web site, or the web.config is missing.

If you’ve ever seen this error and started pulling your hair to solve it; this post is for you.

Let’s say you’re building a custom module for DotNetNuke website.  You want to take advantage of the DotNetNuke wrapper for the Telerik controls.  You register the component

<%@ Register TagPrefix=”dnnUI” Assembly=”DotNetNuke.Web” Namespace=”DotNetNuke.Web.UI.WebControls” %>

You attempt to add the control, but the Intellisense is missing. No problem.  You find an example of the control, add it to your code and modify it. It’s the old “Copy, Paste, Modify” routine.

<dnnUI:DnnGrid ID=”grdSummary” runat=”server” ShowHeader=”true” ShowFooter=”true” GroupingEnabled=”true” >

Everything looks good, but pretty soon this happens

NotAKnownElementIt’s the dreaded squiggly green underline accompanied by an error that leads you on a wild goose chase.  You have no compilation errors.  The site runs fine, so the web.config isn’t missing.  What’s the problem?

The problem is that your custom project cannot find the Telerik dll’s, or the DotNetNuke wrappers for them.  But you say you’ve made the references so it should know.

If you are building your custom module in the standard way the module project is located in the DesktopModules folder of the website.  The compiled DLL for the project is located in the bin folder which sits at the same level in the heirarchy as the DesktopModules folder.  When you run the site the server reads the dlls from the bin location of the site, not the project.  When you’re working on the module project in Visual Studio and that project is loaded by itself, the project isn’t looking for the DLL’s in the site bin folder even when you reference them.  You’re custom module project is looking for the dll’s in the project bin folder.  If they aren’t there, the project can’t find them.

Here’s the solution.  It’s very simple and poorly documented.

Step 1: Add a bin folder

Create a bin folder for the project. If you’re project is at /DesktopModules/MyProject then create the folder /DesktopModules/MyProject/bin

Step 2: Add the wrapper dll’s to the bin folder

Add the following dll’s to the bin folder:

  1. DotNetNuke.dll
  2. DotNetNuke.Web.dll
  3. DotNetNuke.WebControls.dll
  4. Telerik.Web.UI.dll

No need to register, or reference, them.  Just copy and paste right into the folder.  If you have multiple custom module projects you need to add this bin folder with the dll’s to each and every project.

Step 3: Add the Registration tags to your page

In your page you need to register two sets of controls even if you only use one.

<%@ Register TagPrefix="dnnWeb" Assembly="DotNetNuke" Namespace="DotNetNuke.UI.WebControls" %>
<%@ Register TagPrefix="dnnUI" Assembly="DotNetNuke.Web" Namespace="DotNetNuke.Web.UI.WebControls" %>

You can change the TagPrefix to whatever you prefer.

That’s it.  You should now have Intellisense in your project for the DotNetNuke wrapped Telerik controls and the green squiggly warning should be gone.

Let me know if this works for you!

7 comments for “The Dreaded “Not a Known Element” Error

Leave a Reply

Your email address will not be published. Required fields are marked *