Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
1  
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

2 Answers 2

up vote 3 down vote accepted

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

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

Where

src

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

tagname

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

tagprefix

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

 
discard

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.