views:

46

answers:

2

I'm having two connected web parts, the consumer has a button that when I click refreshs the page, which in turns kills the connection. I need to use the passed value from the provider in the btn_Click event. How can I do that?. Is this possbile?.

A: 

Create the event handler in the provider and register it as the handler for the button in the consumer. What you describe reminds me of how custom web part editors work, which happens to be what I'm coding right now.

Kelly French
Well the reason why am using connected web part is I don't want the user to modify the webpart and type in default editor as he has to do this everytime he clicks the button. So I created a provider web part that pass the value directly with a click of a button. But the consumer button reload the page and lose connection. I tried what you said, created an even handler in the provider class, but I get an object ref error, apparently the instance isn't created at the point the event raised. Do you think there are any workarounds this issue?.
DanSogaard
A: 

Take a look at this MSDN magazine article. It's not specific to SharePoint but all the principles apply

Introducing ASP.NET Web Part Connections http://msdn.microsoft.com/en-us/magazine/cc188696.aspx

Rob Windsor