Challenge
When adding SocialCommentWebPart to your Page Layout with SharePoint Designer and trying to set the title of the web part, you cannot do it. SPD removes the Title attribute when you save the Page Layout file.Here are the exact steps.
- Check out Page Layout file in SPD
- Edit File in Advanced Mode
- SocialCommentWebPart looks like this (removed all attributes that are not relevant):
<SPSWC:SocialCommentWebPart runat="server" Title="" ...></SPSWC:SocialCommentWebPart> - Add Title for the SocialCommentWebPart using the Tag Properties Task Pane in SPD
- SocialCommentWebPart looks like this:
<SPSWC:SocialCommentWebPart runat="server" Title="Comments & Questions" ...><SPSWC:SocialCommentControl runat="server">
</SPSWC:SocialCommentControl>
</SPSWC:SocialCommentWebPart> - Save Page Layout file in SPD by clicking Save
- Check In the Page Layout file and select Publish a major version
- Verify that the Page Layout file still contains SocialCommentWebPart tag and Title as in step 5.
- Close Page Layout file in SPD
- Edit the Page Layout File in Advanced Mode in SPD (do not check out the file)
- SocialCommentWebPart tag has reverted to what it was in step 3
<SPSWC:SocialCommentWebPart runat="server" Title="" ...></SPSWC:SocialCommentWebPart> - Obviously using that Page Layout will result in SocialCommentWebPart having Untitled title
Solution
According to Microsoft support, this is by-design and a feature of the product. To alter this functionality I created a simple jQuery script to change the title of the web part and placed the script in my .master page.ExecuteOrDelayUntilScriptLoaded(function () { $(function() { // Set Note Board title $('td[title="Untitled"] span:first').html("Comments & Questions"); }); }, "sp.js");
There is also a PowerShell based workaround for this that might work in some cases here.
Technorati Tags: SharePoint,jQuery
This helped me out after so much frustration! Thanks a lot!!
ReplyDeleteTypical Microsoft. Too arrogant to admit this is a bug. Seriously, who would leave a title out of a web part "by design".
ReplyDelete