Menu Bar working in Identity pages on a Blazor Server side application

I have my Blazor Server side application working with some Syncfusion controls, but when I wanted to add the Syncfusion Menu bar to the Identity pages (cshtml) I was not able to make them work.


My CODE on _Layout.cshtml


@using ApuBlazor2022.Services;

@using Microsoft.AspNetCore.Identity;

@using Syncfusion.Blazor.Navigations;

@inject SessionServices sesionVariable;

@inject SignInManager<IdentityUser> SignInManager;

@inject UserManager<IdentityUser> UserManager;



<!DOCTYPE html>

<html>

<head>

    <meta charset="utf-8" />

    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <title>@ViewData["Title"] - BlazorAuthTemplate</title>

   <base rel='nofollow' href="~/" />


    <link rel="stylesheet" rel='nofollow' href="../css/bootstrap/bootstrap.min.css" />


     <link rel="stylesheet" rel='nofollow' href="../css/site.css" />

</head>

<body>

  <app>

 @if (SignInManager.IsSignedIn(User))

    {


<div class="menu-control">


           <SfMenu TValue="MenuItem">

                <MenuItems >

                    <MenuItem Text = "Home" Url="/" />

                    <MenuItem Text = "Profile" Url="/Identity/Account/Manage/Index" />

                    <MenuItem Text = "Change Password" Url="/Identity/Account/Manage/ChangePassword" />

                    <MenuItem Text = "Log Out" Url="/Identity/Account/Logout" />

                </MenuItems>

            </SfMenu>

 </div>

 }

 else

 {


     <div class="menu-control">

           <SfMenu TValue="MenuItem">

                <MenuItems >

                    <MenuItem Text = "Login" Url="/Identity/Account/Login" />

                    <MenuItem Text = "Forgot Password" Url="/Identity/Account/ForgotPassword" />

                </MenuItems>

            </SfMenu>

 </div>


}


    <div class="mainwindow">


        <main role="main" class="content px-4 pb-3">

            @RenderBody()

        </main>

    </div>

    </app>

     <environment include="Development">

        <script src="~/Identity/lib/jquery/dist/jquery.js"></script>

        <script src="~/Identity/lib/bootstrap/dist/js/bootstrap.bundle.js"></script>

        <script src="~/Identity/js/site.js" asp-append-version="true"></script>

    </environment>

    <environment exclude="Development">

        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"

                asp-fallback-src="~/Identity/lib/jquery/dist/jquery.min.js"

                asp-fallback-test="window.jQuery"

                crossorigin="anonymous"

                integrity="sha384-ZvpUoO/+PpLXR1lu4jmpXWu80pZlYUAfxl5NsBMWOEPSjUn/6Z/hRTt8+pR6L4N2">

        </script>

        <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"

                asp-fallback-src="~/Identity/lib/bootstrap/dist/js/bootstrap.bundle.min.js"

                asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"

                crossorigin="anonymous"

                integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj">

        </script>

        <script src="~/Identity/js/site.js" asp-append-version="true"></script>

    </environment>


    @await RenderSectionAsync("Scripts", required: false)

</body>

</html>




2 Replies

JS Janakiraman Sakthivel Syncfusion Team February 25, 2022 09:41 PM UTC

Hi Juan Maggi,


We need to validate more on this, so will update you the further details on March 1st, 2022. We appreciate your patience until then.


Regards,

Janakiraman S.



TS Thaneegairaj Sankar Syncfusion Team March 22, 2022 03:05 PM UTC

Hi Juan Maggi,

Sorry for the delay,

We can able to add controls in cshtml file. Please refer the below link,

https://www.syncfusion.com/faq/blazor/general/how-do-you-use-blazor-in-an-existing-asp-net-mvc-application


Regards,
Thaneegairaj S



Loader.
Up arrow icon