This might be foolish question, but I am new to the SharePoint 2010 environment. I want to fetch data from a SharePoint list using the CQWP web part. I then want to use this web part as the data source for another web part that can show me this SharePoint list data.

Can I do this? How can I approach this?

2 Answers 2


In short, I don't think that you can use it as a datasource directly. You can change it's appearance - and there are a lot of articles about how to do that. However, actually using it as a data source is a slightly different thing.

Internally, the Content Query Web Part is built around the SPSiteDataQuery object. You can use this to query in the same way as th CQWP, and this will get you a DataTable. You can then bind this to the controls that you want to. E.g.:

SPSiteDataQuery query = new SPSiteDataQuery();
query.Query = "<Where> ... your query here ... </Where>";
// ... Configure your query - scope, types of list, etc.
query.Webs = "<Webs Scope='SiteCollection' />";

DataTable dt = web.GetSiteData(query);

// now use as you wish. E.g.
SPGridView gv = ...
gv.DataSource = dt;

If you mean how do you use this with web part connections - again, I don't think you can.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.