Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7817897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:23:36+00:00 2026-06-02T06:23:36+00:00

Trying to figure out how to hook into some web part verb events; specifically,

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T06:23:37+00:00Added an answer on June 2, 2026 at 6:23 am

    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.

    Imports ((myprojectName)).icBase
    Imports System.Web.UI.WebControls.WebParts
    
    ''' <summary>
    ''' Base class for web parts.
    ''' </summary>
    ''' <remarks></remarks>
    Public MustInherit Class icBaseWebPartControl
        Inherits icBaseUserControlAjax
        Implements IWebPart, IWebActionable
    
    
    #Region "IWebPart Properties"
    
        Private _Title As String
        Private _TitleUrl As String
        Private _TitleIconImageUrl As String
        Private _Description As String
        Private _CatalogIconImageUrl As String
    
        Public ReadOnly Property Subtitle As String Implements IWebPart.Subtitle
            Get
                Return Nothing
            End Get
        End Property
        Public Property Title() As String Implements IWebPart.Title
            Get
                Return Me._Title
            End Get
            Set(ByVal value As String)
                Me._Title = value
            End Set
        End Property
        Public Property Description() As String Implements IWebPart.Description
            Get
                Return Me._Description
            End Get
            Set(ByVal value As String)
                Me._Description = value
            End Set
        End Property
    
        Public Property TitleUrl() As String Implements IWebPart.TitleUrl
            Get
                Return Me._TitleUrl
            End Get
            Set(ByVal value As String)
                Me._TitleUrl = value
            End Set
        End Property
        Public Property TitleIconImageUrl() As String Implements IWebPart.TitleIconImageUrl
            Get
                Return Me._TitleIconImageUrl
            End Get
            Set(ByVal value As String)
                Me._TitleIconImageUrl = value
            End Set
        End Property
    
        Public Property CatalogIconImageUrl() As String Implements IWebPart.CatalogIconImageUrl
            Get
                Return Me._CatalogIconImageUrl
            End Get
            Set(ByVal value As String)
                Me._CatalogIconImageUrl = value
            End Set
        End Property
    
    
        ''' <summary>
        ''' Gives us some functionality of a full web part without actually extending WebPart.  (Me is only an IWebPart, not a true WebPart)
        ''' </summary>
        ''' <remarks></remarks>
        Public ReadOnly Property WebPart() As WebPart
            Get
                Dim wpm As WebPartManager = WebPartManager.GetCurrentWebPartManager(Me.Page)
                Return wpm.WebParts(Me.ID)
            End Get
        End Property
    
    #End Region
    
    
        Public Overridable ReadOnly Property Verbs As System.Web.UI.WebControls.WebParts.WebPartVerbCollection Implements System.Web.UI.WebControls.WebParts.IWebActionable.Verbs
            Get
    
                Dim minimizeVerb As WebPartVerb = New WebPartVerb(ID & "minimizeVerb", AddressOf VerbMinimize, "OnMinimizeClicked('" & Me.ID & "')") With {.Text = "Minimize", .Description = "Minimize this web part"}
                Dim restoreVerb As WebPartVerb = New WebPartVerb(ID & "restoreVerb", AddressOf VerbRestore, "OnRestoreClicked('" & Me.ID & "')") With {.Text = "Restore", .Description = "Restore this web part"}
    
                Dim collection As Collection = New Collection
                Dim returnValue As New WebPartVerbCollection
    
                If Me.WebPart.ChromeState = PartChromeState.Minimized Then
                    collection.Add(restoreVerb)
                    returnValue = New WebPartVerbCollection(collection)
                End If
                If Me.WebPart.ChromeState = PartChromeState.Normal Then
                    collection.Add(minimizeVerb)
                    returnValue = New WebPartVerbCollection(collection)
                End If
                Return returnValue
            End Get
        End Property
    
        Protected Shared Sub VerbRestore(ByVal sender As Object, ByVal e As WebPartEventArgs)
    
            e.WebPart.ChromeState = PartChromeState.Normal
    
        End Sub
    
        Protected Shared Sub VerbMinimize(ByVal sender As Object, ByVal e As WebPartEventArgs)
    
            e.WebPart.ChromeState = PartChromeState.Minimized
    
        End Sub
    End Class
    

    And then I do the following in the client script called by the above:

     // fired when user clicks restore on  any web part 
        function OnRestoreClicked(webPartID) {
            switch (webPartID) {
                case 'ucMyTimekeeping':
                    // don't need to refresh any update panels in this case, because none of the controls in timekeeping are server-side
                    // (unlike files and docs, which have server-side tab containers and tabs)
                    dbLoadTime();
                    break;
                case 'ucMyDocuments':
    
                    //wait a few milliseconds for the server to un-hide the web part  (see icBaseWebPartControl.vb)
                    //hpTODO:  There has GOT to be a better way to do this...  maybe autopostback on the restore link, but not sure how to go about that.
                    setTimeout(function () {
                        HpDocs.UpdatePanel();
                        dbLoadDocs();
                    }, 200);
                    break;
                case 'ucMyFiles':
                    // hpTODO:  same as for ucMyDocuments
                    setTimeout(function () {
                        HpFiles.UpdatePanel();
                        dbLoadFiles();
                    }, 200);
                    break;
                default:
                    __doPostBack(webPartID, '');
    
            }
           //            return false;
        };
    

    And here is what the UpdatePanel() functions look like:

    // do partial postback on the update panel inside the My Files  .ascx
    HpFiles.UpdatePanel = function () {
        var myFiles = $("[id$='_upMyFiles']").attr('id');
        __doPostBack(myFiles);
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to figure out how to programmatically access the web pages in the application.
I have got myself into a bit of a mess trying figure out the
Trying to figure out datetime module and need some help. I've got a string
Trying to figure out a rather annoying IE7 CSS issue. For some strange reason
I'm trying to write a post-commit hook using SharpSVN but can't figure out how
I am trying to figure out a design pattern that would allow hooking into
I'm trying to figure out how to write a pre-commit hook for Git that
Trying to figure out how to do this. I have the style but I'd
Trying to figure out the best way to set up collection lists for users
Trying to figure out which to use.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.