-
07-28-2010, 09:28 PM #1
- Join Date
- Apr 2008
- Location
- Boston, USA
- Posts
- 13,122
- Thanks
- 742
- Thanked 674 Times in 543 Posts
- Blog Entries
- 4
- Feedback Score
- 4 (100%)
Unknown Server Tag for Custom Control - Visual Studio 2010
While working on my first project with Visual Studio 2010, i had to go through some weird stuffs as I tried to convert a Website project to a Website Application project.
One of the problems was with custom controls.
Here is the sample code in C# of a custom control I used for that project.
namespace CustomControls
{
public class MyTextArea : TextBox
{
//----------code here
}
}
On web.cinfig I added
<pages>
<controls>
<add tagPrefix="cc" namespace="CustomControls"/>
</controls>
</pages>
On a page I use the control like this:
<cc:MyTextArea ID="test" runat="server">
</cc:MyTextArea>
It compiles fine without any error. However when I view the page on browser I get the error:
Unknown Server Tag cc:MyTextArea
Note that this code worked fine in both visual studio 2005, and visual studio 2008.
Solution:
Apparently I would need to add the assembly reference on web.config
<pages>
<controls>
<add tagPrefix="cc" namespace="CustomControls" assembly="MyProjectName" />
</controls>
</pages>
-
12-17-2010, 06:39 AM #2
Freshman
- Join Date
- Dec 2010
- Posts
- 43
- Thanks
- 0
- Thanked 0 Times in 0 Posts
- Feedback Score
- 0
That control inherits the DropDownList control For some reason it is never added to the designer and visual studio never really recognizes it.Thanks for sharing information.
Similar Threads
-
Fatal Error - Silverlight Installation - Visual Studio 2008
By manik in forum ASPReplies: 0Last Post: 07-10-2010, 07:49 PM -
Unknown Seo Tips
By Arecher in forum Search Engine OptimizationReplies: 0Last Post: 07-10-2010, 04:07 AM -
unknown web method parameter name methodname - 500 Internal Server Error - ASP .NET
By manik in forum ASPReplies: 0Last Post: 04-10-2010, 09:59 PM -
Warning Unknown modifier
By Abina in forum Web Development - Programming & CodingReplies: 1Last Post: 02-08-2010, 11:53 AM -
3d studio max tutorial....
By CSmhacky in forum Graphics Design & Web DesignReplies: 12Last Post: 02-02-2009, 04:04 PM


Reply With Quote

