views:

113

answers:

1

I have 2 webparts which are connected, where the provider sends a string to the consumer.

However it fails to work if I put any TextBox controls in the consumer webpart. (works fine if I use a Label or Literal control.

The idea is that the consumer is to be composed of form controls like TextBoxes.

e.g. the codeproject sample at http://www.codeproject.com/KB/sharepoint/ConnectingCustomWebParts.aspx

Works fine... until you replace the consumer Label control with a TextBox.

Any help gratefully received.

A: 

Well, if this still needs an answer....

Why it would work with one control and not another, I'm not sure. The reason I couldn't get it to work consistently as is coded in that sample is due to the issues brought to fore in this article. The data just isn't always there in the create controls part of the web part life cycle. I had much better luck getting my data and putting it somewhere, either the session or the viewstate during the ConnectionConsumer event, then setting the value to the control that needed to display it in the OnPreRender event, or just somehow binding to the control, say in a grid, and just calling refresh on the List I was using as a datasource in the OnPreRender, calling Refresh in the create controls didn't work reliably, only in OnPreRender.

Once I truly grokked the web part lifecycle, things became much simpler for me, and finally taught me why in Java portlets they went with the post/redirect/get cycle to try and avoid this very granular coordination between various portlets on a page.

mezmo