Showing posts with label SharePoint 2010. Show all posts
Showing posts with label SharePoint 2010. Show all posts

Sunday, July 17, 2011

SharePoint 2010 CQWP date format

Sometimes we need to customize the style of SharePoint Content Query Web Part (CQWP). If we need to change the datetime column display format, here are general steps we can do:



1. Open your top-level site in Sharepoint Designer, click “All Files – Style Library – XSL Style Sheets – ItemStyle.xsl”
 

2. Please add following reference right below the “xmlns:cmswrt” (usually line 6)

xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"



3. Then we can add xsl variable to save the converted result like below

<xsl:variable name="Created"> <xsl:value-of select="ddwrt:FormatDateTime(string(@Created) ,1033 ,'dd.MM.yyyy')" /></xsl:variable>



Here is more information about  ddwrt:FormatDateTime:


List of supported locale identifiers in Word



Custom Date and Time Format Strings



SharePoint Data View Web Part Extension Functions in the ddwrt Namespace

Saturday, July 16, 2011

Post.aspx overflow in customized master page

We are using customized master page in our new SharePoint 2010 publishing website. After enabling the blog site template, we find the blog article display page: post.aspx has some display problem with our master page layout.



We're using fixed width in master page. However, the post.aspx always stretch over the fixed width and the horizontal scrollbar always shows up no matter how short the post content is.



After checking the page css heritance, we find the culprit is the empty comment style settings in the blog.css file.  We can find it in the following folder of 14 hive direcotry:

14\TEMPLATE\LAYOUTS\1033\STYLES



And here is the line we need to modify:

.ms-commentsempty

{

width:775px;

}



As we see, it has fixed width settings. We can change it to 100% if your customized master page mainContent div is small than this.