Open Closed

Page Toolbar #125


User avatar
0
ididsbury created

Hi,

In MVC / Razor, how can I add a button to the page toolbar (on a custom page) such that it displays on the top right? I've recently upgraded to 2.6 and I see that functionality has been added to add content / buttons to the toolbars for pages within the various modules. However, I need to add buttons to the toolbars in custom pages. Is it possible to access the toolbar directly on the pages, similar to the breadcrumb via PageLayout.Content?

Probably missing something straightforward.

Appreciate any help.

Thanks

Ian


4 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi @ididsbury,

    Do you mean to add a toolbar to a custom page?

    If you use a layout page, the toolbar will be displayed on your page, You only need to add toolbar contributors according to the documentation.

    If you are not using a layout page, you can add a toolbar conponent to page , like this.

    If you want a new toolbar, you can add your own toolbar component, like this, The important thing is StandardToolbars.Main, you need to replace it with your own toolbar constant.

  • User Avatar
    0
    ididsbury created

    Hi,

    I want to achieve something like this Page Toolbar but, say, on the home page in the startup tenplate.

    The theme seems to adds a top row to each page. This row includes the title and breadcrumb on the left and the toolbar area / div on the right. I can't seem to work out how to add a button to the toolbar.

  • User Avatar
    0
    ididsbury created

    Note that I've tried to add a button to the home page as per the above link however it doesn't add the button. A button is correctly added though for pre-built pages i.e. User page.

    If a Page 'content' toolbar does not exist (even through there is space reserved), can you confirm how to remove the top row / component from the AbpPage in the theme such that i can add my own.

    Thanks

  • User Avatar
    0
    ididsbury created

    Hi,

    I figured it out. Added below for reference.

    There is a named RenderSection in the theme Application layout called 'content_toolbar'. To add a button to this section then add the following on any page:

    @section content_toolbar{ <abp-button button-type="Primary"> Click Me</abp-button> }

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09