Open Closed

ABP Toolbar Action Hooks #8042


User avatar
0
BenS-FreshRF created
  • ABP Framework version: v8.3.0
  • UI Type: Blazor WASM
  • Database System: EF Core (PostgreSQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace:
  • Steps to reproduce the issue: Click any toolbar option

The ABP Toolbar is useful but we have a number of actions we want to perform on Logout or navigation to the My Account pages that exist on the host.

I can't find any way to hook into those actions to perform actions before redirection. For Logout I've hooked into the OpenIddict event handlers to cleanup stuff but for the My Account link I can't find any events to hook into so have had to resort to some obvious error messages to alleviate issues users may face when returning to the main application.

Regardless hooking into the OpenIddict events on the Host side requires exposing more services to perform the needed actions, services already available on the client side.

Is there any way to hook into those actions on the client before redirection to the host?

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

5 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The toolbar will render as HTML link. So, there is no action hook design.

    But you can add some JavaScript to listen to the event if a toolbar link is clicked.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    BenS-FreshRF created

    Ok, I've managed to attach an event handler to the Manage Account button via its Id "MenuItem_Account_Manage", still wary that the redirect will trigger before the new handler has completed but is working for now.

    The Logout button however doesn't have an Id or any classes or any other parameters to make it easy to attach event handlers to. Can the next version add an Id to that button please?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The Logout button however doesn't have an Id or any classes or any other parameters to make it easy to attach event handlers to.

    Can you share the HTML code of the whole menu?

    I think you can use the CSS selector to query the Logout button.

    Thanks.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    BenS-FreshRF created

    The My Account button has an Id, but Logout does not. It could be selected by using "a.dropdown-item:last-child" or the like, but that's a very fragile way of implementing event handlers.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    ok, I will add an id to the logout element.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 28, 2026, 11:44
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.