SharePoint - Display Full List in Content Query Web Part in SharePoint 2010

Asked By Nilesh Patkar
14-Oct-11 09:07 AM
Hi,
I created a first list on Page and
a second list in Content Query Web Part by selcting list from Query properties.

For page, it display all columns and rows.
For CQWP, it display only first column.How I display all columns for CQWP ?

Regards,
Nilesh...

  R B replied to Nilesh Patkar
14-Oct-11 09:13 AM
Hello,

You pass query string in for First Page into Second Page then display only one Column.

You need fetch all record instead of pass single id.

try this.

and let me know your feedback

  Reena Jain replied to Nilesh Patkar
14-Oct-11 09:19 AM
Hi,

If you need to retrieve items from a list when developing web parts, application pages or custom field types you can best use the SPQueryobject from the SharePoint object model. This object is located in the Microsoft.SharePoint namespace of the Microsoft.SharePoint.dll located in the Global Assembly Cache.

Instantiate the object as follows:

SPQuery qry = new SPQuery();

The most important property is the Query property, which needs to be set to your CAML query:

string camlquery = "<OrderBy><FieldRef Name='Country' /></OrderBy><Where>"
    + "<Eq><FieldRef Name='LastName' /><Value Type='Text'>Smith</Value></Eq>"
    + </Where>";
qry.Query = camlquery;

At this point you can execute the query on your list:

SPListItemCollection listItemsCollection = list.GetItems(qry);

A small remark with the GetItems method of the SPList instance: this method returns a collection of type SPListItemCollection. It is possible that it is easier working with a DataTable. In that case you can execute the query as follows:

DataTable listItemsTable = list.GetItems(qry).GetDataTable();

let me know whether its working for you or not
  Nilesh Patkar replied to R B
14-Oct-11 09:21 AM
Hi

I am using only a single page in SharePoint 2010....
First I insert a list on Page...It display all rows and columns
Then insert a Content Query Web Part..choose a list from third option of CQWP..but displays only single column.







  Nilesh Patkar replied to R B
14-Oct-11 09:26 AM








  Devil Scorpio replied to Nilesh Patkar
14-Oct-11 03:09 PM
HI,

Code to Display Full List In Content Query Webpart

<DIV id="ListPlaceholder"><IMG src="/_layouts/images/GEARS_AN.GIF"></DIV>
 
    <!-- Paste the URL of the source list below: -->
    <iframe id="SourceList" style="display:none;" src="/site/Lists/Calendar/Current%20Month%20Events.aspx" onload="DisplayThisList()"></iframe>
 
    <script type="text/javascript">
    function DisplayThisList()
    {
      var placeholder = document.getElementById("ListPlaceholder");
      var displaylist = null;
      var sourcelist = document.getElementById("SourceList");
      try {
         if(sourcelist.contentDocument)
          // Firefox, Opera
          {
          displaylist = sourcelist.contentDocument.getElementById("WebPartWPQ2") ;
        }
         else if(sourcelist.contentWindow)
          // Internet Explorer
          {
          displaylist = sourcelist.contentWindow.document.getElementById("WebPartWPQ2") ;
        }
         else if(sourcelist.document)
          // Others?
          {
          displaylist = sourcelist.document.getElementById("WebPartWPQ2") ;
        }
      }
      catch(err)
      {
        alert ("Loading failed");
      }
      var allDescendants = displaylist.getElementsByTagName("*");
      placeholder.innerHTML = displaylist.innerHTML;
    }
    </script>
Create New Account
help
SharePoint List Data Integration using SharePoint Designer 2010 Microsoft Office SharePoint Designer 2010 is a powerful and wonderful invention from Microsoft Corporation for creating and customizing SharePoint 2010 sites. In this article we will explore how to integrate SharePoint List data into a SharePoint page using Data Integration functionality provided by SharePoint Designer 2010
Change the default images on the home page Sharepoint 2010 using C#. hi, i need to Change the default images on the home page Sharepoint 2010( / _layouts / images / homepageSamplePhoto.jpg) using c#. thanks Hello Paul, You can create an application page with a FileUpload server control. Follow these steps: • Crate a follow these steps in visual Project menu, click Add New Item. • In the Add New Item dialog box, select Application Page . • Name the page UploadLogo, and then click Add. • In the layout of the application page
steps to deploy a custom master page to SharePoint 2010 Hi All, Please provide me steps to deploy a custom master page to SharePoint 2010 via VS 2010. Refer this link for deploy a custom master page to SharePoint 2010 http: / / sharepointchick.com / archive / 2010 / 03 / 26 / deploying-a-custom-master-page
upgrade that environment from sharepoint 2007b to SharePoint 2010. Hi, How to upgrade that environment from sharepoint 2007b to SharePoint 2010. After the upgrade how to create a new template in SharePoint 2010. Microsoft recently released the Beta version of SharePoint Server 2010. Microsoft claims that migrating from
What's New for Developers in SharePoint 2010 Object Model? SharePoint 2010 Object Model comes with new functionality and introduces a new Client API. In this article I will cover the main new components in SharePoint 2010 Object Model and will show the types of solutions that can be built using them This week I was attending the SharePoint 2010 Connections Conference in Amsterdam. It is always exciting to hear what's new and what