Tuesday, March 10, 2009

How to determine if your webpart is providing for others

In my continuation with my webpart for connecting two SPGridViews together I came across the need to determine if the current instance of the part was actually providing for any other webparts. The reason I need to know this is because I wanted to render the first column as a select link if it was providing to another part, but otherwise just render as a standard datacolumn.

Here is the solution I came up with:

 Private Function IsProviding() As Boolean
For Each c As WebPartConnection In Me.WebPartManager.Connections
If c.Provider Is Me Then
Return True
End If
Next
Return False
End Function
Does anyone have another way to determine this?
 



No comments: