0

I have referenced multiple user controls within the web.config file, because I was receiving an error in the individual pages and they are used in multiple pages, the code I wrote is as follows:

<pages>
  <controls>
    <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add tagPrefix="IPAMControl" tagName="confirm_list" src="~/Controls/confirmed_participant_list.ascx"/>
    <add tagPrefix="IPAMControl" tagName="contact_us" src="~/Controls/contact_us.ascx" />
    <add tagPrefix="IPAMControl" tagName="erh_list" src="~/Controls/erh_list.ascx" />
    <add tagPrefix="IPAMControl" tagName="graphic_with_thumbnail" src="~/Controls/graphic_with_thumbnail.ascx" />
    <add tagPrefix="IPAMControl" tagName="header" src="~/Controls/header.ascx" />
    <add tagPrefix="IPAMControl" tagName="footer" src="~/Controls/footer.ascx" />
    <add tagPrefix="IPAMControl" tagName="main_tnavbar" src="~/Controls/main_tnavbar.ascx" />
    <add tagPrefix="IPAMControl" tagName="program_header" src="~/Controls/program_header.ascx" />
    <add tagPrefix="IPAMControl" tagName="program_list" src="~/Controls/program_list.ascx" />
    <add tagPrefix="IPAMControl" tagName="signup_section" src="~/Controls/signup_section.ascx" />
    <add tagPrefix="IPAMControl" tagName="speaker_list" src="~/Controls/speaker_list.ascx" />
    <add tagPrefix="IPAMControl" tagName="track" src="~/Controls/track.ascx" />
  </controls>
</pages>

However, when I go into the HTML markup file (aspx) and beging typing "<IPAM..." nothing appears and I get an error of "Unrecognized namespace 'IPAMControls'.

Below is a sample page I am trying to insert one of the controls into:

<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterNew.master" CodeFile="~/programs/programs.aspx.cs" Inherits="IPAM.Website.programs.programs" %>
<asp:Content ID="MainContent" ContentPlaceHolderID="Main" Runat="Server">
    <h1>Upcoming Programs</h1>
<hr size="1">
<p align="center"><a href="#long" class="bodylink">Long Programs</a> | <a href="#workshops" class="bodylink">Workshops</a> | <a href="#affiliate" class="bodylink">Affiliates' & Other Workshops</a> | <a href="#summer" class="bodylink">Summer Programs &amp; Special Events</a>
</p>


Our upcoming programs include long programs, short programs (workshops), reunion conferences, and summer programs. Click on the program title for detailed information.
    <%--<a name="long"><ipam:program_list id="idProgramList1" Type="Long" Time="Upcoming" runat="server" /></a>
    <a name="workshops"><ipam:program_list id="idProgramList2" Type="Short" Time="Upcoming" runat="server" /></a> 
    <a name="affiliate"><ipam:program_list id="idProgramList3" Type="Affiliate" Time="Upcoming" runat="server" /></a>
    <a name="summer"><ipam:program_list id="idProgramList5" Type="Summer" Time="Upcoming" runat="server" /></a>
    <a name="special"><ipam:program_list ID="idProgramList6" Type="Special" Time="Upcoming" runat="server" /></a>--%>
</asp:Content> 

What am I doing wrong or missing.

mattgcon
  • 4,768
  • 19
  • 69
  • 117
  • I need someone who is willing to actually look at the question and help figure out why this isnt working, instead of just telling me how to use a user control – mattgcon Sep 14 '10 at 21:01

1 Answers1

1

You use user controls like this:

<IPAMControl:confirm_list ID="<id>" runat="server"></IPAMControl:confirm_list>

I use VS2008 and it doesn't come up in my intellisense either.

[Edit]

<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" 
AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="accesscontrol_test" %>
<%@ Register TagPrefix="IPAMControl" TagName="confirm_list" Src="Copy of nav.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="NEContent" Runat="Server">
<h1>Upcoming Programs</h1>
<hr size="1">
<p align="center"><a href="#long" >Long Programs</a></p>


Our upcoming programs include long programs, short programs (workshops), reunion 
conferences, and summer programs. Click on the program title for detailed information.
<a name="long"><IPAMControl:confirm_list id="idconfirm_list" runat="server">
</IPAMControl:confirm_list></a>
</asp:Content> 

The above code works fine for me, try registering it at the top of the page like I did, then we can help pinpoint what's causing the issue. You'll obviously have to change the directives, but register it in the page and not the web config.

[Edit]

Try adding this to your web config in <pages><controls>

<add tagPrefix="IMAPControl" namespace="IMAP.Webmaster.Controls" assembly="IMAP.Webmaster" />
  • 1
    I know how to use them, but my question is, why am I receiving an error that IPAMControls is an Unrecognized namespace and intellisense is not working with these (Im using VS2008) – mattgcon Sep 14 '10 at 20:52
  • Oh, the pages that I am trying to add them in are child pages to MasterPageFiles, could that be the problem and if so how do I correct it – mattgcon Sep 14 '10 at 20:54
  • When you were registering the user control on a page, were you still getting the same error or different? –  Sep 14 '10 at 21:12
  • I was getting another error all together (" Element is not known element") <-- That is the error message I am receiving. I apologize for being so testy too, this is something that I have not been able to get any help on whatsoever. – mattgcon Sep 14 '10 at 21:17
  • I added a sample of a page the controls are being placed into – mattgcon Sep 14 '10 at 21:21
  • Ok, this might get rid of the Element is not known, in your bin folder, delete Register.dll and App_Licenses.dll if they exists then rebuild your website. –  Sep 14 '10 at 21:28
  • Those two files are not created when you build a web application, so I do not have those, nor have I ever seen them – mattgcon Sep 14 '10 at 21:34
  • Check my edits, because if that doesn't work for you, I'll have to check something else.. –  Sep 14 '10 at 21:46
  • The only issue I have with registering it in each page is that there are over 100 pages I have to do this for. – mattgcon Sep 14 '10 at 21:49
  • Oh and another thing I noticed (might not matter but worth the quick thought). The main namespace fo the web app is IPAM.Webmaster, and I am simply extending the namespace to be like IPAM.Webmaster.Helpers, IPAM.Webmaster.Controls for different functionalities of the app. Could this have been the kiss of death – mattgcon Sep 14 '10 at 21:52
  • Well sometimes you'll get the Element is not known.. because there was an error in your codebehind files.. you might want to try making sure you have spelled things properly. –  Sep 14 '10 at 21:53
  • LOL yeah I just painstackingly went through for the past two days making sure everything was spelled correctly. – mattgcon Sep 14 '10 at 21:54
  • Hey, read up more on this, describes a user control within another control: http://stackoverflow.com/questions/680519/in-web-config-is-it-possible-to-register-all-user-controls-in-specified-directory –  Sep 14 '10 at 22:15
  • Im getting some real wierd stuff now, I am getting "Could not load type 'IPAM.Website.programs.programs" and I am also getting "The type or namspace name 'App_Classes' does not exist in the namespace 'IPAM'" (this error is referring to namespace IPAM.App_Classes, in the App_Classes folder. – mattgcon Sep 14 '10 at 22:16
  • Actually theseuser controls are not being used in other control, they are being used in simple aspx pages. I did try what you suggested and this is what I got: "Could not load type 'IPAM.Controls.confirmed_participant_list'." – mattgcon Sep 14 '10 at 22:23