SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a question regarding the directives in the MasterPage. So if I deploy a custom template to ControlTemplates in SharePoint folder, to use it I will need to write a directive which imports that control. It is clear, but the question is:

How can I import all my custom templates from a folder controltempaltes?

I tried:

<%@ Register TagPrefix="src" src="~/_controltemplates/CUSTOMTemplates" %>
<%@ Register TagPrefix="src" src="~/_controltemplates/CUSTOMTemplates/*" %>

Without success ...

share|improve this question
That's not how ASP.NET controls are included using the Register Prefix. You can only register one ASCX control at a time. – James Love Aug 2 '12 at 12:38
up vote 3 down vote accepted

You can't. The syntax for @ Register with a user control is:

<%@ Register tagprefix="tagprefix"
   src="pathname" %>



The location (relative or absolute) of the declarative ASP.NET User Controls file to associate with the tagprefix:tagname pair.


An arbitrary alias to associate with a class. This attribute is only used for user controls.


An arbitrary alias that provides a shorthand reference to the namespace of the markup being used in the file that contains the directive.

Note the singular file.

share|improve this answer
Ok thank you, I hoped it was possible but it seems not. What I do like that at least registering one src path to my custom controls which are not user controls but server controls (webcontrols) does not require one by one registering – Shkipper Aug 2 '12 at 14:25

As far as I know you have to add each control template separately. Another option would be to write code which iterates through all your custom control templates and add them programmatically, wrapping this code in one control template.

share|improve this answer
Thanks but it is probably overhead – Shkipper Aug 2 '12 at 14:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.