views:

294

answers:

2

I have two webparts in two different webpart zones. They provide a Master/Details scenario using gridviews. They are defined using static connections. Initially this works great.

As soon as I close one of the webparts I get the message "You are about to close the webpart. It is currently providing data to other webparts, and these connections will be deleted if this webpart is closed. Click OK to continue.

This in itself is fine so I click close and my part closes. However when I open the catalog zone and re-add the webpart (which gets added fine) the connection between the parts is broken (as described by the message).

However my webpart connection in my HTML is still visible. I can only assume it uses the ASPNET membership or other to remember the ID of the connection and not to enable it.

My question is how do I re-enable the connection in code or other!?

Thanks.

A: 

OK I have solved my issue. I added the following into WebpartManager.WebpartAdded()

    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Dim wp1 As WebPart = zoneDiaryTopLeft.WebParts("Ucl_Diary_Summary1")
    Dim wp2 As WebPart = zoneDiaryTopRight.WebParts("Ucl_DiaryAwaitingReview1")

    Dim providerConnectionPoint As ProviderConnectionPoint = _
    WebPartManager1.GetProviderConnectionPoints(wp1)("IMessageProvider")

    Dim consumerConnectionPoint As ConsumerConnectionPoint = _
    WebPartManager1.GetConsumerConnectionPoints(wp2)("IMessageConsumer")

    Dim returnValue As WebPartConnection
    returnValue = WebPartManager1.ConnectWebParts(wp1, providerConnectionPoint, wp2, consumerConnectionPoint)
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

All said, how does it know/store the connection that was removed and remember to NOT allow that to be active!? It would be much easier if I could stop the connection being removed or re-enable it. I know dynamic connections are an option but I dont want users having this ability as they having a hard enough job understanding the fact you can drag a webpart around the screen. Connections are rocketscience to them.

JamesM
A: 

Master!

Congratulations man, this is a really valuable information and an easy to understand guide.

Really thanks.