By: Neil Barkhina
Everyone knows that SharePoint is a great platform for Intranets. But more and more people are starting to use it for its excellent Web Content Management features. When using SharePoint to create a public facing site, the typical strategy is to approach it as a vanilla ASP .NET Application. However, there are certain techniques that I have learned over the years which have helped me incorporate that balance between traditional ASP .NET and the out of the box SharePoint feature set. I would like to highlight 3 of those techniques below.
Datasheet View Background Color
Many websites tend to have a solid background color, which usually has a CSS class like Body { background-color: Some Color; } in their HTML. One thing you may have noticed is that whatever color you set as your background is the color that your datasheet view will take on. So if you are using a color other than white, especially a dark shade, this makes the Datasheet quite unreadable and very difficult to use. The way I fix this is with a short snippet of Javascript on my Master Page. The basic idea is we are reading the URL of the site into a variable. When viewing Datasheet mode, SharePoint appends the String "ShowInGrid" to your query string. If the URL contains this string we output a Style tag and set the background to white. Just make sure you put this Javascript further down in your HTML than your main CSS links. This is because browsers process style in order of sequence. Here is code snippet:
<script type="text/javascript">
fullURL = parent.document.URL
var bodyfix = "<style type=\"text/css\">.body{ background-color:#FFFFFF; }</style>";
if (fullURL.indexOf("ShowInGrid")!=-1)
document.write(bodyfix);
</script>
Disabling Name.DLL ActiveX Message
This is one that many folks have faced in the past. SharePoint 2007 has integration with OCS. Whenever a People or Groups Column appears in SharePoint, you get presence information in the form of a bubble about whether they are online or not. The way this is accomplished is using a particular ActiveX control called Name.DLL. While this is great functionality, the problem is when you have a public facing site where Presence technology has no value. The last thing you'd want is to burden your users with a Security Prompt asking them to install some strange DLL (this could be quite the turn off for people if you are trying to drive traffic to your website).
The way to fix this is to find the place in your Masterpage where you are including the init.js file. Delete this line in your Masterpage and replace in with a custom JavaScript file that overrides the Name.DLL include. For a copy of this JavaScript file, you may download it from the following link:
http://www.gig-werks.com/custom_activex_override.js
Hidden ContentPlaceHolders
Finally, one of the most important aspects of adapting a SharePoint Masterpage to the public facing world is to know which contentplaceholders to hide. There are several versions of the so called "minimal master page" floating around the web. The one I use has been created out of sheer trial and error. It serves as a good balance for what tends to mess with Public Facing sites while still maintaining the SharePoint functionality you need such as the Page Editing Toolbar and the Quick launch. Enjoy:
<asp:Panel visible="false" runat="server">
<input type="text" name="__spDummyText1" style="display:none;" size=1/>
<input type="text" name="__spDummyText2" style="display:none;" size=1/>
<asp:ContentPlaceHolder id="PlaceHolderBodyAreaClass" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderTitleAreaClass" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderUtilityContent" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderFormDigest" runat="server">
<SharePointWebControls:FormDigest runat="server" />
</asp:ContentPlaceHolder>
<asp:ContentPlaceHolder id="PlaceHolderPageTitle" runat="server" />
<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderLeftNavBar" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderBodyLeftBorder" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderNavSpacer" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderTitleLeftBorder" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderTitleAreaSeparator" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderMiniConsole" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderCalendarNavigator" runat ="server" />
<asp:ContentPlaceHolder id="PlaceHolderLeftActions" runat ="server"/>
<asp:ContentPlaceHolder id="PlaceHolderPageDescription" runat ="server"/>
<asp:ContentPlaceHolder id="PlaceHolderBodyRightMargin" runat="server" />
<asp:ContentPlaceHolder id="PlaceHolderTitleRightMargin" runat="server" />
<asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderPageImage" runat="server"/>
</asp:Panel>
-Neil Barkhina