IronicMuffin IronicMuffin - 8 months ago 85
ASP.NET (C#) Question

How can I register an assembly in a master page that is accessible to the content pages?

I am experimenting with master pages, and I want the AjaxControlToolkit available on every page in my web app, so I placed it in the head of my master page.

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>

This threw an error: Unknown server tag 'ajax:Accordion'.

If I place it on the content page, it works fine. Am I missing something here?


You need to register the assembly in each page that uses it, or in your web.config. Simply registering it in your master page won't cause the assembly to be visible to pages that use the master page.

See this post for instructions on how to do this in web.config.

The web.config changes necessary:

        <add tagPrefix="scottgu" src="~/Controls/Header.ascx" tagName="header"/>
        <add tagPrefix="scottgu" src="~/Controls/Footer.ascx" tagName="footer"/>
        <add tagPrefix="ControlVendor" assembly="ControlVendorAssembly"/>