Visual Studio requires a ScriptManager reference to compile Ajax enabled solution

The Problem

Visual Studio requires a ScriptManager to compile a Ajax enabled solution for a SharePoint web part.

Visual Studio Error on compile says:

Solution.cs: (Build Error)

Error    1    The type or namespace name ‘ScriptManager’ could not be found (are you missing a using directive or an assembly reference?)    C:\…\Solution.cs

 

 

The Solution:

A Reference dll is missing in your solution. You need to add a reference to System.Web.Extentions.

Page Titles disappear after Ajax event

The Problem:

SharePoint page titles when using Ajax may turn to square icons. This is the rendering of the title tag in the masterpage, or where the page title is specified. A normal SharePoint masterpage specifies the title on 3 lines, the first line is for the opening tag, second line contains the content place holder for page title, and the 3rd line in the masterpage’s title is for the closing title tag. You get something that looks like this:

BlueBand.master
<Title ID=onetidTitle>

<asp:ContentPlaceHolder id=PlaceHolderPageTitle runat=”server”/>

</Title>

Rendered HTML after Ajax panel update:
<title>

Home

</title>

Basically, the tabs indenting “Home” are rendered as nothing in IE7 Page Title, but in the tab title, they are rendered as 3 little squares.

The Solution:

Put the title tag on one line! That’s it! No need for JavaScript or anything else when using Ajax on a page! Just edit the CORRECT masterpage, (For Publishing Portal, the default is BlueBand.master, for Team and Collaboration sites, it’s Default.master) I made the mistake of editing Default.Master for the fix and was using a Publishing Portal, and didn’t see my changes!

Here’s the code fix:

BlueBand.master (or Default.master):
<title id=”onetidTitle”><asp:ContentPlaceHolder id=”PlaceHolderPageTitle” runat=”server”/></title>

Having ANY tabs in your source code will render nothing for your page title. You MAY use spaces, but NOT formatting tabs.

SharePoint Designer – CSS Caching issues with Visual Studio Web Part packages

I have recently ran into an issue with SharePoint Designer and modifying a CSS file. The CSS file would not update my changes.

I waited a 1/2 a day, checked different browsers, cleared my temp/etc, tried virtual machines that havent seen the website in months. Nothing was reflecting my SharePoint Designer CSS changes. I was also logged in as the same user, and I checked to make sure that the CSS file was being referenced, and no others were overwritting it.

What could it be? Well, after confirming that even deleting the file would not change any of the CSS, I worked with my co-worker about server-side caching. These CSS files deployed Via web part are located in the 12 hive. When you edit them in SPD, the file is a ghosted version. After you publish the file, you can Reset to Site Definition. We checked the Blobcache settings via server side and noticed that the caching was set to 24 hours. Another CSS file deployed via web part was ghosted, and the changes would reflect real time as I saved. Really strange behavior.

I will keep looking into this and post a solution.