Can SharePoint WebPart connect to a custom SharePoint web page

I need to use the value passed by the default sharepoint filter web part. I do not see how the user sharepoint web part can establish a connection and receive data. Is it possible?

Update

The WebPart provider is the default SharePoint list filter WebPart. Custom WebPart is a custom website.

This is the code I came up with, but the Connections option is still inactive on the SharePoint page. On the page, I have a SharePoint list filter web pane and my CustomPageViewer web page.

namespace PageViewerWithConnections.CustomPageViewer
{
    [ToolboxItemAttribute(false)]
    public class CustomPageViewer : System.Web.UI.WebControls.WebParts.WebPart
    {
        IFilterValues _filterVals;

        [ConnectionConsumer("Consumer connection", "Consumer param")]
        public void ConsumeFilter(IFilterValues filterValues)
        {
            _filterVals = filterValues;
        }

        Microsoft.SharePoint.WebPartPages.PageViewerWebPart objPageViewer;
        protected override void CreateChildControls()
        {

        }
    }
}

- URL- - - , - SharePoint. , - SharePoint List - .

+3
2

-, IFilterValues ConnectionConsumerAttribute.

private IFilterValues _filterVals;

[ConnectionConsumer("Filter Consumer", "FilterConsumer")]
public void ConsumeFilter(IFilterValues filterValues)
{
    _filterVals = filterValues;
}

, OnPreRender , OnRender, , , .

:

http://msdn.microsoft.com/en-us/library/ms494838(v=office.12).aspx

http://msdn.microsoft.com/en-us/library/ms469765.aspx

+3

CreateChildControls base.CreateChildControls();

:


    List<IFilterValues> providers = new List<IFilterValues>();

    protected override void CreateChildControls()
    {
        if (providers.Count > 0 && providers[0].ParameterValues != null)
        {
            this.FilterValue1 = providers[0].ParameterValues[0];
        }

        base.CreateChildControls();
    }

    [ConnectionConsumer("Provider WebPart", "IFilterValues", AllowsMultipleConnections = false)]
    public void SetConnectionInterface(IFilterValues provider) 
    {
        if (provider != null)
        {
            this.providers.Add(provider);
            List<ConsumerParameter> parameters = new List<ConsumerParameter>();

            parameters.Add(new ConsumerParameter("param1",
                  ConsumerParameterCapabilities.SupportsSingleValue | ConsumerParameterCapabilities.SupportsEmptyValue | ConsumerParameterCapabilities.SupportsAllValue));

           provider.SetConsumerParameters(new ReadOnlyCollection<ConsumerParameter>(parameters)); 
        } 
    }
+1

All Articles