Trying to figure out how to hook into some web part verb events; specifically, I want to know when the user minimizes or restores any web part, and which one. I’m not on a sharepoint platform – strictly asp.net (4) ajax (2).
I call the following code in page load of my web part (my web part inherits UserControl and Implements IWebPart):
Sub test_WebPartZoneVerbEventHandlers()
Dim i As Integer = 0
For Each z As WebPartZone In WebPartManager.GetCurrentWebPartManager(Me.Page).Zones
Dim restoreVerb As WebPartVerb = z.RestoreVerb
Dim minimizeVerb As WebPartVerb = z.MinimizeVerb
If Not IsNothing(restoreVerb) Then
If Not IsNothing(restoreVerb.ClientClickHandler) Then
testTextArea.InnerHtml = testTextArea.InnerHtml & i & "<br/>" & restoreVerb.ClientClickHandler
End If
If Not IsNothing(restoreVerb.ServerClickHandler) Then
testTextArea.InnerHtml = testTextArea.InnerHtml & i & "<br/>" & restoreVerb.ServerClickHandler().ToString()
End If
End If
If Not IsNothing(minimizeVerb) Then
If Not IsNothing(minimizeVerb.ClientClickHandler) Then
testTextArea.InnerHtml = testTextArea.InnerHtml & i & "<br/>" & minimizeVerb.ClientClickHandler
End If
If Not IsNothing(minimizeVerb.ServerClickHandler) Then
testTextArea.InnerHtml = testTextArea.InnerHtml & i & "<br/>" & minimizeVerb.ServerClickHandler().ToString()
End If
End If
i = i + 1
Next
End Sub
But I don’t get any names for the handlers. Here is the output (contents of testTextArea):
0<br/>0<br/>1<br/>1<br/>2<br/>2<br/>0<br/>0<br/>1<br/>1<br/>2<br/>2<br/>
Anyone know why nothing is showing up for the client/server click handlers?
Couldn’t figure out what the event names were, and frankly I’m getting fed up with UpdatePanels and thinking about getting rid of them entirely, but I was able to solve my problem by overriding the verbs property on my web part.
And then I do the following in the client script called by the above:
And here is what the UpdatePanel() functions look like: