views:

671

answers:

1

I am using some custom WebParts in SharePoint like (http://www.codeplex.com/smartpart) with some controls. I have more than one WebPart at different pages. How is it possible to link them together? For example at the button click event handler or the hyper link target what should be URL to navigate to?

+1  A: 

Connecting web parts in SharePoint is usually done by transferring data between them. For example, clicking an item in one web part could provide further details in another. Here is an example on the Office web site. The web parts are configured by connecting them together using controls on the web part title bar.

There are many examples for developing your own. Here is one I've found that's quite detailed and there are many others if you search for consumer producer connected web part.

Edit: It is not possible to access the controls in another connected web part (thanks kusek). The solution is to analyze the data coming from the other web part and change behaviour accordingly.

Alex Angas
What if I want to access a control in a webpart from another webpart? Is it possible?
Ahmad Farid
As Alex Said Connecting Web Part means Tranferring data between them, accessing control of other WebPart is not possible. But you can send data and based on the data you sent make the other webpart controls to behave.
Kusek
if we want to do some connection between web parts, wont that be possible?for example isnt there something like session variables?
Ahmad Farid
Yes I believe you could use session variables as well. See http://smartpart.codeplex.com/Thread/View.aspx?ThreadId=36669
Alex Angas