Calling Razor component from the Sidebar Component

How do you call a Razor component when selecting an item when using a Sidebar Component in the OnSelect event? The Sidebar  examples that I got were to display info on the main page, but I want to call a different  Razor component as in the standard Blazor NavMenu. 

See the code below.

 public void OnSelect(NodeSelectEventArgs args)

    {

        if (args.NodeData.Text == "Application Status")

        {

            // Want to call a Razor component named  "ApplicationStatus" from here.

           // I have tried <ApplicationStatus></ApplicationStatus> but is getting a build error        

       }

}


3 Replies

SS Sivakumar ShunmugaSundaram Syncfusion Team May 12, 2022 11:29 AM UTC

Hi Fouche,


Greetings from Syncfusion support.


We have validated your reported issue in the Blazor Sidebar component. We already have a similar requirement by rendering the content description on the main layout for each List item selection. Check the below link for reference.


Demo: https://blazor.syncfusion.com/demos/sidebar/sidebar-with-listview?theme=fluent


In a similarity to the requirement, we have navigated to multiple pages while selecting TreeView node items within the Sidebar component. We have handled this exact scenario in the below forum.


Forum: https://www.syncfusion.com/forums/172991/loading-page-following-nodeselected?reply=S2uMUM


Kindly check the attached details to see whether it is suitable for your requirements. Please get back to us if you need any further assistance.


Regards,

Sivakumar S



FB Fouche Burgers May 13, 2022 04:36 AM UTC

The  NavigateUrl="navigateUrl" in the  <TreeViewFieldsSettings works 100%.


For example: 

 <TreeViewFieldsSettings Id="nodeId" Text="nodeText" DataSource="treedata" HasChildren="hasChild" IconCss="iconCss" NavigateUrl="navigateUrl" ParentID="pid">



IL Indhumathy Loganathan Syncfusion Team May 16, 2022 06:04 AM UTC

Hi Fouche,


We are glad that your reported issue has been resolved. Please get back to us if you need any further assistance.


Regards,

Indhumathy L


Loader.
Up arrow icon