Learning SharePoint Part IV

I have learned so much in the past few days, I am not sure where to start.  So, here is tidbit to get started with:

   1: <SharePoint:DelegateControl ID="DelegateControl5" runat="server" ControlId="SmallSearchInputBox" />

What is this thing called SharePoint:DelegateControl?  Well, it looks like it is the product group’s version of SmartPart.  Any control that is registered can be instantiated by this syntax:

   1: <SharePoint:DelegateControl ID="[MyUniqueControlId]" runat="server" ControlId="[MyControlName]" />

Here is another tidbit. If you want to deploy a custom master page and use a custom style sheet, create a feature that looks like this:

   1: <?xml version="1.0" encoding="utf-8"?>
   2: <Feature  Id="e6070a56-757f-4a9c-842c-030e596a08d0"
   3:           Title="IpmMasterPages"
   4:           Description="Installs a custom master page for the Innovation Administration Site"
   5:           Version=""
   6:           Hidden="FALSE"
   7:           Scope="Web"
   8:           DefaultResourceFile="core"
   9:           xmlns="http://schemas.microsoft.com/sharepoint/">  
  10:     <ElementManifests>
  11:       <ElementManifest Location="elements.xml" />
  12:       <ElementFile Location="Masters\ipmadministration.master" />
  13:       <ElementFile Location="Masters\ipm.css" />
  14:     </ElementManifests>  
  15: </Feature>

Elements.xml looks like this:

   1: <?xml version="1.0" encoding="utf-8" ?>
   2: <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
   3:   <Module Name="IpmMasterPages" Url="_catalogs/masterpage" Path="Masters" RootWebOnly="FALSE">
   4:     <File Url="ipmadministration.master" Type="GhostableInLibrary" />
   5:   </Module>
   6:   <Module Name="IpmStyles" Url="Styles" Path="Masters" RootWebOnly="FALSE">    
   7:     <File Url="ipm.css" />
   8:   </Module>
   9: </Elements>

NOTE: Remember that the style sheet is NOT a list item, so if you copy the <File> element from the master module and don’t forget to remove the Type=”GhostableInLibrary” attribute, you will get an error when you create the site.    

And add a link to your style sheet in the master page

   1: <link rel="stylesheet" href="../../styles/ipm.css" type="text/css" />

In onet.xml, activate the custom master page feature:

   1: <!-- Custom master page-->
   2: <Feature ID="e6070a56-757f-4a9c-842c-030e596a08d0" />

Setup a feature receiver for the custom master age  and update the master page url on activation:

   1: using (SPWeb web = (SPWeb)properties.Feature.Parent)
   2: {
   3:     web.MasterUrl = web.MasterUrl.Replace("default.master", "ipmadministration.master");                        
   4:     web.Update();
   5: }

Happy SharePointing….

Skip to main content