.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Customize content query web part in custom page layout

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :C#

I am trying to build a custom page layout which should have the following web parts:

1. Announcements,

2. Doc Library

3. custom list items

And the data in these web parts should be from the site in which we create this page. For example, if we try to create a page in site A, then the announcements displayed should be from site-A, doc lib that is in site-A...

And I am trying to insert a content query web part in the page layout using sharepoint designer, and modify the query to insert the announcements list in the site. But how can I query to pull the data from corresponding site.

Thanks for the help.

View Complete Post

More Related Resource Links

Content Query Web Part Sharepoint 2010 AND Customize the data presentation


In fields to display you have a Title field. We will like to show two columns (Section Name and Status) in the title field, but only the fist one is displayed in the result.We use this syntax:

Column [Group];Column [Group]

When I use this formula

Section Name [Agresso R&D Base Columns] ; Status [Agresso R&D Base Columns ]

in the title field, the Section Name is displayed, and no Status, When I use this formula

Status [Agresso R&D Base Columns ]; Section Name [Agresso R&D Base Columns] ;

in the title field the Status field is displayed, and no section name. Is this a bug? or is it an other way to show both columns in the title field?


Fields to display Depending on the scope of your query, you can select one or more site or list columns whose values you want to show in the display slots for this style. To specify a column from a particular group, type the name of the group in square brackets after the column name, for example, Column [Group]. Be sure to separate each column you enter with a semi-colon.


Adding the Content Editor Web Part to a SharePoint Layout .aspx page



we've created a layout page that contains the Rich Text Editor web part. But the client requires a web part that allows the embedding of audio/video files. The Rich Text Editor strips out the objects when we try to embed them.

I've used the Content Editor Web Part to add audio and video files (by manually adding the web part to the page), but I can't find the definition for that web part to include it in the layout page so that the client doesn't need to manually add the web part themselves to every page that requires it. (Which could be many pages.)

Any help would be appreciated.



Content Query Web Part missing in SharePoint 2010

If you don't see content query web part listed in the web parts list, this is because you have not enabled "Search Server Web Parts" feature in site collection features. Enable this feature and content query web part will show in the list of web parts.

Content deployment: pages not based on a page layout

Is it possible to use content deplyoment feature when pages (in page library) are not based on a Page Layout?

SharePoint 2007 - Consolidating everything as feature into WSP [Content Type, Page Layout, Pages, Ma


Hello –


Overview – We are building a Mobile Web Site using SharePoint 2007. The big screen site has been already built and we need to integrate the mobile site into same site collection of big screen –


·         The Mobile site will use the existing content types of existing big screen site

·         We will build a new custom Master page

Customizing the Content Query Web Part in SharePoint Server 2007

Walk through how to customize the Content Query Web Part in SharePoint Server 2007 to query content across multiple sites in a site collection and display the results in any way that XSL can support. Learn how to get similar results when customizing the CQWP does not meet your needs.

Why is the Content by Query Web Part CommonViewFields attribute not working as expected?

I am using the Content by Query Web Part to show data from a Custom List.  I have already added to the XSL "ItemStyle" sheet so that I can pick the correct Item Style.  That has worked fine - I have been able to show whatever fields I would like and apply any CSS Styles I would like to them.  The issue I am having is in formatting the field correctly.  I have two different fields in my current example that need to be formatted: [1] I want to show an Image, but right now it shows the URL  [2] I want to show Rich Text, but right now it shows all the HTML Code as Plain Text.  I have looked at many articles online, and they all tell me to change the following in the WEBPART file from: <property name="CommonViewFields" type="string" /> to: <property name="CommonViewFields" type="string">Thumbnail, Image;Teaser, RichHTML;</property> What I am doing wrong?  The Web Part still runs, but it does not format the fields any differently.  Thanks for the help!

Problem with Content Query Webpart and Custom Userfields

Dear Community, I am using Sharepoint 2007's content query webpart to access content types from 2 lists each contained in a different sitecollection. To achieve this, I used this tutorial: http://www.heathersolomon.com/blog/articles/CustomItemStyle.aspx. The tutorial worked great. By using the property CommonViewFields and modifing the XML Stylesheets accordingly, i could access almost every field. Even User Fieldtypes like editor and author were accessible by adding (editor,User) or (author,User) to the CommonViewFields property. But when I tried to access the custom made userfield "Username" in the same way (adding Username,User to the property), the webpart threw an error and couldn't be displayed anymore. When I changed it to Username,Text , no error occured but it naturally didn't show up, since it is the wrong fieldtype. I hope some of you can help me, since all my researches on this topic only brought up some more people with the same problem, but no solution to it. Thanks in advance, SoundofSilence

How to switch to a different Web Part page layout?

I'm not sure if the capabilities are available in SP2010, but I have a web part page that I would like to change to a different layout. In the past I have always recreated the page, which takes a ton of time, but I would rather switch to a different layout on the fly and move everything around again. Is this possible?

Why do we need Common view fields in content query web part?

I am a bit confused on the purpose of "CommonViewFields" in CQWP. Almost all the write-ups on the web says that if we need a custom column to be available in the web part's XSL, we need to export the webpart file, add the columns to "CommonViewFields", import the web part to the site. However I noticed that, when I create a custom style template in my "ItemStyle.xsl" and simply add a line like <xsl:value-of select="@MyCustomColmn"/>, then "MyCustomColumn" appears automatically under "Fields to display" in the tool pane as a text box prompt, when I edit the web part and select my style template. I can then simply fill-in my column display name under "MyCustomColumn" and the web part works perfectly fine. (There is NO NEED to export the web part, edit the ".webpart" file and add "commonviewfields" etc..etc..etc) If this works, then what is the real need for "commonviewfields" ? Can someone shed light on this? I am totally confused.. (SharePoint 2010)          

How to keep custom web part collapsed on page load

Hi, I have developed one custom web part and successfully deployed it on MOSS site. Now the requirement is that the custom web part should be collapse mode by default. how to do this? Which property need to set and where? Please suggest.

Content Query Web Part (CQWP) fails to show picture items from a document/picture library in an anon

I have a Picture Library and am trying to use the CQWP to display a list of items in the library.  The web part shows the items fine in authenticated mode, but it fails to show the items to anonymous users. The error log message is: Error while executing web part: System.NullReferenceException: Object reference not set to an instance of an object.     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.SetDocumentIconUrlAndOnClickString(SPWeb web, DataRow row, String strDefaultItemOpen, Boolean fSetDocIcon, Boolean fSetOnClick, String fileRefColumnRef, String progIdColumnRef, String fsobjTypeColumnRef, String permMaskColumnRef)     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.PreProcessForDocumentIconAndOnClickAttribute()     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.AddContentQueryData()     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.GetXPathNavigator(String viewPath)     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform) I'm running SP 2010.  I've tried various scenarios including: 1. Using the default publishing template. 2. Using the blank site template with publishing and lock down features enabled. 3. Us

Adding a web part to "My Content" page causes error

Under a "My Content" personal page, a user (me) chose to add the "SQL Server Reporting Services Report Viewer" web part to a page. This was repeated with a test account and the same thing happened. Is there a way to fix this? Prior to this, adding a Content Editor Web Part seemed to work just fine.

Content Query Web Part, QueryOverride and sorting by site

Hello, I want to display documents from various sub-sites in my portal. These documents must be grouped by site and only documents created in the last 7 days should appear in the CQWP. The first difficulty I encountered was that I cannot apply a filter like " date created< today - 7" in the tool pane of CQWP. So I searched the web and found that I can create a custom query by exporting the web part and changing the QueryOverride property. Thing is that you cannot specify a CAML group clause in the QueryOverride property. It is just not supported. It seems though (thanks to this post: http://social.msdn.microsoft.com/forums/en-US/sharepointdevelopment/thread/92e335ad-48f6-4572-a314-752c8b41ef8f) that if you specify a "order by" clause for the field you want to group by, then you can use this field in the group by section of the CQWP tool pane. Thus, I need to sort my results by site (because I want to group by site afterwards). But how do I do that? After another long research, I found out (http://msdn.microsoft.com/en-us/library/ff380147%28office.12%29.aspx#odcsp2007CustomizeCWQP_CustomizingUsingtUIwebpartFile) that I have to specify the ViewFieldsOverride property in order to include the original site that my document comes from. And in the property I have to include the following property: <ProjectProperty Name="Title"/>. But still I ca

Create a Page Layout for Enterprise Wiki with content

I need to create a Page Layout that for an Enterprise Wiki Page that already has content in the Rich Text HTML Field so when people go in to create a new page based off of the Page Layout they can go in and just replace the text with their own. Can this be done?

Content Query Web Part Error

Hi,I get the following error when i try to add a ContentByQuery.webpart using SharePoint Server 2007:   "Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator."   I've seen a lot of people having this problem when they aren't on an admin account, but I am, and this error happens before I can do any configuration at all to the webpart.   The webpart didn't show up in the webpart list at first, so I added it from the webparts gallery. The actual name of the part is Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.Is this the wrong kind of webpart or what seems to be the problem? I don't have much experience in Sharepoint since before, as you might can tell.Help would be VERY appreciated, thanks in advance.

content editor web part in publishing page

I have created a page in pages library using my custom pagelayout and added a cewp.I also added some images from image library in source code of cewp where each image is link and takes to a diff page.this doent work in a publishing page but works fine in other pages any suggestions
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend