1

I am currently using 3 web parts which are connected (webpart A connected to B, B connected to C). The problem lays in the connection between B and C. Webpart B is a provider and a consumer and only contains a dropbox with some variables. The selecteditem from this dropbox is the provided value. This is the connectionprovider in code i am using in webpart B.

[ConnectionProvider("DropboxValue", "dbv")]
public IDropBoxValue provider()
{
     return this;
}

This is the connectionconsumer i am using in webpart C.

[ConnectionConsumer("DropboxValue", "dbv")]
public void consumer(IDropBoxValue providerInterface)
{
     _provider = providerInterface;
}

on the first load of the page a DropBoxValue is automatically selected and webpart C uses this variable to create a SPGridView with data. Now if i change this variable by selecting a new item from the dropbox webpart C does not respond to it. In fact if i run the project in debug nothing is being called from webpart C.

So why does Webpart C not respond to changes in webpart B?

Extra Edit Whenever i change the selectedValue in Webpart B it changes it's text to "No Provider Web Part Connected." This error is created by me and is thrown when

if (_Provider == null)

_Provider is the Interface of webpart A provider.

1 Answer 1

1

The error in my case lays in using the CreateChildControls and the OnPreRender functions. I called the provider in the CreateChildControls while it should have been called in the OnPreRender function.

If you call a different Webpart in the CreateChildControls it is possible that the CreateChildControls of that webpart have not been initiated. When OnPreRender is called all CreateChildControl functions of all webparts have been called. And so at the time that OnPreRender is called all webparts on the current page will excist.

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.