2.  Configuration

XML Controls are configured in the web.config. It is possible to configure the file folders, assembly references and using statements.

 

Section

Description

/ui/using

Defines using statements that are included in the interim C# file.

/ui/references

Defines the assemblies to reference in the compilation step.

/controlSources

Defines the file directories to look for XML Controls and assemblies where web controls may appear.

 

An entry in the control sources section can have the following attributes:

 

Attribute

Description

Mode

If mode is “off”, the entry is ignored.

Namespace

Defines the namespace of the webcontrols in this source.

Folder

The file directory.

Assembly

An assembly that contains webcontrols.

Deep

Defines that subfolders should be included, if the source is a directory.

Prefix

If specified, controls in the XML Control must have this namespace.

 

Control sources are searched in the sequence that is specified in the web.config. If two XML Controls have the same name, the control that occurs in the first control source is used and the other ignored. This allows XML Controls to be overridden, simply by insert the new control in a control source that is placed first.

2.1.  XML Control Configuration example

:
    
<controlSources>
      
<source mode="on" namespace="Sitecore.Web.UI.XmlControls" folder="/sitecore/shell/override" deep="true"/>
      
<source mode="on" namespace="myNameSpace" folder="/sitecore modules/controls" deep="true"/>
        :
    
</controlSources>
      :
    
<!-- UI -->
    
<ui>
      
<usings>
        
<using>System.Collections</using>
        
<using>System.Reflection</using>
          :
      
</usings>
      
<references>
        
<reference>System.dll</reference>
        
<reference>System.Data.dll</reference>
          :
      
</references>
      :
    
</ui>