So the error that I'm seeing is that PixelTextArea is not a known element. This class is in the APP_Code directory and the control that I'm adding it to is a user control in another directory outside of that.
Any ideas how I fix this?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Nico VanHaaster20 reputationPosted Oct 1, 2008, 9:16 AM EDT
Two things here, one it sounds like you your controls in the correct place. The code in the App_Code folder etc. Now have you referenced this control in your web.config or at the top of the page with the <% @Register %> tag?
To use a custom control inside of .Net it needs to know where to find it. This will include the virtual path to the control ie ~/Controls/Customcontrol.asax.
Example http://weblogs.asp.net/scottgu/archive/2006/11/26/tip-trick-how-to-register-user-controls-and-custom-controls-in-web-config.aspx
Jerry Blum14 reputationPosted Oct 1, 2008, 9:45 AM EDT
[code]
<%@ Register TagPrefix="customControl" TagName="pixelTextArea" Src="~\App_Code\Common\Controls\PixelTextArea.cs" %>
[code]
Like I said before this is a class in a .cs file that is inherited from System.Web.UI.HtmlControls.HtmlTextArea and is in App_Code directory. The file that I added the code above to is a user control with an ascx file and .cs file. Is this something that I will need to rebuild a userControl to handle or should I be able to use this as is? Hopefully somebody will be able to help.
Nico VanHaaster20 reputationPosted Oct 1, 2008, 9:48 AM EDT
Your register tag is registering a file in the App_code directory which is a cs file, you need to reference the path of the actual ascx file
<%@ Register TagPrefix="customControl" TagName="pixelTextArea" Src="~\App_Code\Common\Controls\PixelTextArea.cs" %>
Like this below
<%@ Register TagPrefix="customControl" TagName="pixelTextArea" Src~\CustomControls\PixelTextArea.ascx" %>
Jerry Blum14 reputationPosted Oct 1, 2008, 11:36 AM EDT
Nico VanHaaster20 reputationPosted Oct 1, 2008, 12:02 PM EDT
Yeah i would just create a new custom control and set the inheritance to whatever you like just replace after :
public
partial class newcontrol: System...... whatever you like it to enheritJerry Blum14 reputationPosted Oct 1, 2008, 12:02 PM EDT