SharePoint Custom Connected Visual Webparts RRS feed

  • Question

  • Dear Experts,

    I have created a Visual Web Part (Provider web part) which inherits from IFilters and a consumer web part which consumes data from above Provider. Consumer web part has below code snippet to get data from Provider

     [ConnectionConsumer("Connection Filters")]
            public void ConsumerMethod(IFilters Provider)
                strCode = Provider.Code;
                strFromDate = Provider.FromDate;
                strToDate = Provider.ToDate;

    Above combination of Provider and Consumer web part works very well.

    Now question is, Can we use SharePoint OOB List Filter web parts as a provider for my custom consumer Visual web part, is this possible? Any references will be of great help.

    Thanks in Advance,


    Thanks.... ________________ Baba (MCTS, MCPD)

    • Edited by Babasaheb Wednesday, September 4, 2019 7:28 AM
    Wednesday, September 4, 2019 7:23 AM

All replies

  • Hi,

    Check the demo in below thread.

    public class MyConsumerWebPart : System.Web.UI.WebControls.WebParts.WebPart
    private ITransformableFilterValues filterWebPartsProvider;
    public string FilterFieldName
    {  get;  set;  }
    public string FilterFieldValue
    {  get; set; }
    //Use with OOB Filter Webparts
    [ConnectionConsumer(“Filter Consumer using FilterWebparts provider”, “FilterWebPartsConsumer”)]
    public void FilterWebPartsConsumer(ITransformableFilterValues Provider)
    filterWebPartsProvider = Provider;
    protected override void OnPreRender(EventArgs e)
    this.FilterFieldName = null;
    this.FilterFieldValue = null;
    if (filterWebPartsProvider != null)
    this.FilterFieldName = filterWebPartsProvider.ParameterName;
    ReadOnlyCollection filterValues = filterWebPartsProvider.ParameterValues;
    if (filterValues != null)
    foreach (string filterValue in filterValues)
    this.FilterFieldValue += filterValue + “;”;

    Best Regards,


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Thursday, September 5, 2019 1:36 AM