Creating a Footer with a User Control

My goal was to add a simple footer area to the masterpage, with copyright year and a feedback link-simple stuff. I wanted it so that if the link or the date had to be changed, I wouldn’t have to update every instance of the masterpage. My brain still approaches Sharepoint with Dreamweaver mentalities. I am used to templates and library items in DW and how they work. Equating a masterpage to a DW template is faulty because it is no easy task to make a change to the masterpage and just hit “update” and ta da, the whole site is updated. When you make a change on the master page, you have to go into each site and subsite that uses the masterpage, change the masterpage to something else, and then change it back to have the updates show. For a large intranet, that is just not feasible.

Our old intranet uses Cold Fusion, and we use includes to pull in frequently changing text. I asked one of our .net guys is their was a .net version of this and he suggested user controls.

I opened my site in Sharepoint Designer and went to File > New, then clicked on the Page tab, ASP.NET, and selected Web User Control.

A base file will display. I removed the head content that automatically referenced the theme-it is unnecessary and caused problems with the rendering. I then pasted the html code for my footer. The css references were added to my theme file so that they would be picked up.

The first mistake I made was saving the user control within the site. That doesn’t work. I did some research and found out that user controls must be saved in the Controltemplates folder in the 12 hive on the server. Your path would be something like this:

Now you have to add the user control to the masterpage and register it within the page. Find where you want to add the user control and add this code, where mp_footer = name of YOUR user control:

To register the user control, go to the top of your masterpage. There will be several user controls already listed there. Add this code after the other user control registration lines:

Save the masterpage, check it in, and then, yes, you must do the switch masterpage, switch back thing, but just this once πŸ˜‰

Pretty easy and updating the user control automatically updates every instance throughout your masterpages, so I’m sure you can imagine the many ways you can use these in your sites. One tip about editing the user controls once they are on the server-open them in Notepad. I opened them in Designer and had trouble saving them back to the server. Enjoy πŸ˜‰


SharePoint Training Review: InfoPath

I have been out of town for almost two weeks now. The last week of August, I went to Nashville for Infopath training. The day after I got back, I had to evacuate for Hurricane Gustav. I just got back home this morning. I’m trying to remember my training… πŸ˜‰

I went to the InfoPath class offered by SharePoint Solutions. It was three days long and covered InfoPath, SharePoint, and Workflows. The instructor was very nice and knowledgeable. I have a much better understanding of how to use IP to create forms and even mimic applications. I really thingk that IP will become a primary means for my group to create small apps, as most of the apps we build are just web versions of print forms. The savings in development time will be huge. I will post more as I remember-still have hurricane brain fog πŸ˜‰