Hide Tool Bar items when I am using both the ToolBar and Custom Toolbar

By default I look all toolbar items and custom tool bar items that are available to potentially use on a page. As the page is load I want to hide toolbar and custom toolbar items based on what the user is allowed to do. This page worked just fine till I wanted a custom button, now I am not able to hide buttons.; The page will get a error on page load.

This code her loads with now problem

<SfPdfViewer2 @ref="Viewer" DocumentPath="@DocumentPath" Height="100vh" Width="100%">

    <PdfViewerToolbarSettings ToolbarItems="@ToolbarItems" CustomToolbarItems="@CustomToolbarItems" />

    <PdfViewerEvents DocumentLoaded="@DocumentLoaded" ></PdfViewerEvents>

</SfPdfViewer2>

This code errors on load

    <SfPdfViewer2 @ref="PDFViewer" DocumentPath="@DocumentPath" ToolbarSettings="@ToolbarSettings" Height="100vh" Width="100%">

        <PdfViewerToolbarSettings ToolbarItems="@ToolbarItems" CustomToolbarItems="@CustomToolbarItems" />

        <PdfViewerEvents DocumentLoaded="@DocumentLoaded" ></PdfViewerEvents>

    </SfPdfViewer2>


Is there is way to customize the menus when the page is initiali



3 Replies

VS Venkada Subramanian Durai Syncfusion Team April 15, 2025 03:21 PM UTC

Hi Scott Hood,

We have prepared a sample that meets your requirements. In the attached sample, we have hidden the ToolbarItems and CustomToolbarItems in the DocumentLoaded event as per your request.

Kindly check whether it meets your needs. If not, please modify the attached sample accordingly and share it with us.

Regards,
Venkada Subramanian Durai


Attachment: Net8Server_40c69971.zip


SH Scott Hood replied to Venkada Subramanian Durai April 15, 2025 03:39 PM UTC

I downloaded the sample and it did not include what you described.  Maybe the wrong sample was attached to the ticket?



VS Venkada Subramanian Durai Syncfusion Team April 15, 2025 03:51 PM UTC

Hi Scott Hood,

The solution was provided in the Counter.razor file of the shared project. I have also set it as the initial page that loads when you run the project.

Additionally, you can find the specific code snippet in the attached file.




Attachment: code_dbc95751.zip

Loader.
Up arrow icon