Error: "Element "MyUsercontrol" is not a known element"

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
11/16/2011 4:20:24 PM
Gravatar
Total Posts 21

Error: "Element "MyUsercontrol" is not a known element"

I built a custom project with this folder structure is as follows:

Folder UserControls
- PromoControl.ascx
    Folder CommonControls
    - UcTextBox.ascx

The problem is, when I add my UcTextBox.ascx control to the PromoControl.ascx, I get the error:

"Element 'UcTextBox' is not a known element. This can occur if there is a compilation error in the Web site, or the web.config file is missing."

The web.config file is in the project, I can build and publish and everything works fine. In VisualStuido though, the control in the markup has the green squiggly lines under it, and there's no intellisense. From the Promo Control, I'm referencing the UcTextBox control like this, which was the default:
<%@ Register Src="~/UserControls/CommonControls/UcTextBox.ascx" TagPrefix="uc1" TagName="UcTextBox" %>

Is there a better way to check for errors in a userControl in mojoPortal? When building Web Forms I would just right click the control and select "Build" but I don't see that in web applications.

Thanks

 

11/16/2011 5:35:40 PM
Gravatar
Total Posts 21

Re: Error: "Element "MyUsercontrol" is not a known element"

It looks like I can't add ANY nested user controls. Is there something I'm missing here?

11/17/2011 7:36:12 AM
Gravatar
Total Posts 18439

Re: Error: "Element "MyUsercontrol" is not a known element"

Are you using a post build event to copy your files up to mojoportal web?

Those paths need to be correct at runtime when they run in the context of mojoPortal. Typcially you don't want to scatter the files for a custom feature all over the place so in your web app you would have a folder for the feature name and all the files for the feature will be below that folder and the post build event will copy them up to the mojoportal web project and they land in the feature name folder there.

ie.

myfeature/
myfeature/UserControls/

and

<%@ Register Src="~/myfeature/UserControls/CommonControls/UcTextBox.ascx" TagPrefix="uc1" TagName="UcTextBox" %>

study the code for existing features like the blog, it has nested usercontrols.

I think the GuestBook tutorial videos would help you.

Best,

Joe

11/17/2011 10:43:11 AM
Gravatar
Total Posts 21

Re: Error: "Element "MyUsercontrol" is not a known element"

Thanks Joe. I am copying the files to the mojoPortal.Web directories in a post build event as described in the Guestbook video. Everything works well until I try to nest a user control. My goal was to build a text box user control complete with a caption and validation controls then reuse that throughout my project, so I'm not sure the myFeature/userControls directory structure would be ideal - unless it won't work with the directory structure I'm trying to use :)

I've tried putting all user controls in the same directory, and have even tried adding new, "empty" controls in case there was something causing an error in the child control, but I keep getting the same error.

I realize I'm not giving enough info here, I was just hoping this was a common newbie mistake that others had already encountered. I'll take a look at the GuestBook video again and see if that shines some light on this.

Thanks again.

You must sign in to post in the forums. This thread is closed to new posts.