Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

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

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