+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    manik's Avatar
    manik is offline Om Shanti! Recent Blog:
    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%)

    Default 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>
    Boston Web Developer LLC
    Free Classified Ads & BUSINESS/PROFESSIONAL SOCIAL NETWORK


  2. #2
    samson77 is offline Freshman
    Join Date
    Dec 2010
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

    Default

    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

  1. Replies: 0
    Last Post: 07-10-2010, 07:49 PM
  2. Unknown Seo Tips
    By Arecher in forum Search Engine Optimization
    Replies: 0
    Last Post: 07-10-2010, 04:07 AM
  3. Replies: 0
    Last Post: 04-10-2010, 09:59 PM
  4. Warning Unknown modifier
    By Abina in forum Web Development - Programming & Coding
    Replies: 1
    Last Post: 02-08-2010, 11:53 AM
  5. 3d studio max tutorial....
    By CSmhacky in forum Graphics Design & Web Design
    Replies: 12
    Last Post: 02-02-2009, 04:04 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts