Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm adding some functionality to the ContentQueryWebPart by inheriting from ContentByQueryWebPart... but when I try and add a new WebPart Property, the actual field does not show up when I edit the webpart! Has anyone else tried this?

Here is an example of a property I am trying to add:

   [WebBrowsable(true), Personalizable(PersonalizationScope.Shared),     WebDisplayName("Page Filter Field"), 
    WebDescription("Enter the Page Field name which the CQWP will filter on"),

    public string PageFilterField
            return _pageFilterField;

            _pageFilterField = value;
share|improve this question

1 Answer 1

up vote 1 down vote accepted

You need to add a customised ToolPart for your property

public class CustomWebPart : ContentByQueryWebPart {
    public override ToolPart[] GetToolParts() {
        List<ToolPart> result = new List<ToolPart>(base.GetToolParts());
        result.Add(new YourCustomToolPart());
        return result.ToArray();

And for the ToolPart see here

share|improve this answer
Perfect!! Thanks for leading me down the right track. I used this link as an example to get my properties showing up:… – user424 Jan 17 '11 at 2:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.