asp.net core Archives - Tech Insights Unveiling Tomorrow's Tech Today, Where Innovation Meets Insight Sat, 28 Oct 2023 07:37:36 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.2 https://i0.wp.com/reactconf.org/wp-content/uploads/2023/11/cropped-reactconf.png?fit=32%2C32&ssl=1 asp.net core Archives - Tech Insights 32 32 230003556 .NET CORS | How to Enable CORS in ASP.NET CORE WEB API https://reactconf.org/net-cors-how-to-enable-cors-in-asp-net-core-web-api/ https://reactconf.org/net-cors-how-to-enable-cors-in-asp-net-core-web-api/#respond Sat, 28 Oct 2023 07:37:36 +0000 https://labpys.com/?p=2018 What is CORS CORS stands for Cross-Origin Resource Sharing. It is an HTTP protocol that allows web applications to access resources hosted on different domains. In this article, we will …

The post .NET CORS | How to Enable CORS in ASP.NET CORE WEB API appeared first on Tech Insights.

]]>
What is CORS

CORS stands for Cross-Origin Resource Sharing. It is an HTTP protocol that allows web applications to access resources hosted on different domains. In this article, we will learn How to Enable CORS in ASP.NET Core Web API.

How to Enable CORS

Enabling CORS in ASP.NET Core Web API is quite easy, as the platform comes with built-in features to support that.

Enable CORS Policy with Specific Origin

You need to configure CORS in the Program.cs file, if you are using below .NET 6 then configure CORS in the startup.cs file.

Open the Program.cs file in your editor and modify it. Here is how to enable CORS in ASP.NET Core.

   Services.AddCors(Opt =>
       {
         Opt.AddPolicy("CorsPolicy", policy =>
        {
             policy.AllowAnyHeader().AllowAnyMethod().WithOrigins("https://localhost:4200");
                 });
            });

app.UseCors("CorsPolicy");

Above code example, we are using the WithOrigins method, which accepts a list of string URIs as parameters, and allows you to specify multiple origins for a single CORS Policy.

Enable CORS Policy with any Origin

With this CORS policy, we are grating access to all origins “AllowAnyOrigin”, allowing any request header “AllowAnyHeader”, and permitting any HTTP method “AllowAnyMethod”

 Services.AddCors(Opt =>
       {
         Opt.AddPolicy("CorsPolicy", policy =>
        {
             policy.AllowAnyOrigin().
                    AllowAnyHeader().
                    AllowAnyMethod(); 
                 });
            });

app.UseCors("CorsPolicy");

CORS Policy Options

Here are the CORS policy options you can use to configure your ASP.NET Core WEB API:

  1. AllowAnyOrigin: To accept requests from any domain
  2. WithOrigins: To allow requests only from specific domains.
  3. WithMethods: to specify which HTTP methods are allowed in the request.
  4. AllowAnyMethod: To allow any HTTP method (GET, POST, PUT, etc.) in the request.
  5. AllowAnyHeader: To accept any HTTP request header.
  6. WithHeaders: To specify which HTTP headers are allowed in the request.
  7. WithExposedHeaders: To specify which headers are safe to expose to the API of a CORS API specification.
  8. AllowCredentials: To allow requests with credentials.

Conclusion

In this article, we have shown you how to enable CORS(Cross-Origin Resource Sharing) in an ASP.NET Core Web API. CORS is essential for allowing web applications hosted in different domains to access your API securely.

See More Articles:

Difference between IEnumerable and IQueryable in C#

The post .NET CORS | How to Enable CORS in ASP.NET CORE WEB API appeared first on Tech Insights.

]]>
https://reactconf.org/net-cors-how-to-enable-cors-in-asp-net-core-web-api/feed/ 0 2018
Fast Insert with Entity Framework Core in ASP.NET Core https://reactconf.org/fast-insert-ef-core-aspnet-core/ https://reactconf.org/fast-insert-ef-core-aspnet-core/#respond Wed, 03 May 2023 02:41:06 +0000 https://labpys.com/?p=1207 In this article, we will discuss Fast Insert with Entity Framework Core in ASP.NET Core. Entity Framework Core’s fast insert feature enables you to insert multiple records in the database …

The post Fast Insert with Entity Framework Core in ASP.NET Core appeared first on Tech Insights.

]]>
In this article, we will discuss Fast Insert with Entity Framework Core in ASP.NET Core. Entity Framework Core’s fast insert feature enables you to insert multiple records in the database in a single call, which is much faster than inserting records one by one.

ASP.NET Core is a popular framework for building web applications. It provides a robust set of features and tools to build modern, scalable, and high-performance applications. Entity Framework Core is one of the essential components of ASP.NET Core that allows developers to interact with the database using an object-relational mapping (ORM) approach.

When inserting data into the database using Entity Framework Core, developers often face performance issues, especially when dealing with large datasets. In this article, we will discuss how to use Entity Framework Core’s fast insert feature to improve the performance of data insertion.

Fast Insert in Entity Framework Core

Fast insert is a feature of Entity Framework Core that allows you to insert multiple records in the database in a single call. By default, Entity Framework Core inserts record one by one, which can be very slow and time-consuming when dealing with a large dataset. With a fast insert, you can reduce the number of round trips to the database, which improves the performance of data insertion.

Benefits of Fast Insert in Entity Framework Core

Using fast insert in Entity Framework Core provides several benefits, including:

  • Improved performance: Fast insert reduces the number of round trips to the database, which improves the performance of data insertion.
  • Reduced network traffic: Fast insert sends a single SQL statement to the database, reducing the network traffic between the application and the database server.
  • Reduced memory consumption: Fast insert reduces the memory consumption of the application, as it doesn’t have to keep track of multiple entities when inserting data into the database.

Implementing Fast Insert in Entity Framework Core

To use a fast insert in Entity Framework Core, you need to install a package from NuGet. Once you have installed the package, you can use the BulkInsert() extension method to insert multiple records in the database.

Install Required Software

  • NET Core SDK from here
  • Visual Studio or Visual Studio Code from here
  • SQL Server database from here

Create an ASP.NET Core project

step-by-step procedure to create an ASP.NET Core project

  • Open Visual Studio and click on “Create a new project” on the start page
  • In the “Create a new project” dialog box, select “ASP.NET Core Web Application” from the list of available project templates
  • In the “Create a new ASP.NET Core web application” dialog box, select the “Web Application” template.
  • Choose a name and location for your project, and then click on the “Create” button.

Install NuGet Packages

To add new features or libraries to our project, we may need to install additional packages that can be found on NuGet, a package manager. NET. By installing NuGet packages, we can easily incorporate external code into our project and enhance its functionality.

  • Microsoft Entity Framework Core Sql Server.
  • Microsoft Entity Framework Core Tools.
  • EFCore.BulkExtensions.

Configuring the appsetting.json

Configuring the appsetting.json file is an important step in setting up an ASP.NET Core application. This file allows us to store configuration values and settings that are required by our application. By editing the appsetting.json file, we can easily modify our application’s behavior without having to modify the source code.

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "ConnectionStrings": {
    "sqlconnection": "Server=(local)\\MSSQL;Database=EFCoreDB;Trusted_Connection=True;MultipleActiveResultSets=true" 

  },
  "AllowedHosts": "*"
}

Configure Program.cs

The program.cs is a file in an ASP.NET Core project that contains the application’s entry point. It is responsible for configuring the application’s services, logging, and middleware pipeline. By editing the code in Program.cs, we can customize the behavior of our ASP.NET Core application and add new functionality as needed

using Asp.netcore_Tutorials.Models; 
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using System.Configuration;
  

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddDbContext<EfCoreContext>(conn => conn.UseSqlServer(builder.Configuration.GetConnectionString("sqlconnection"))); 

builder.Services.AddControllersWithViews(); 

var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Home/Error");
    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
    app.UseHsts();
}

app.UseHttpsRedirection();

app.UseStaticFiles();

app.UseRouting();

app.UseAuthorization();

app.UseSession();

app.MapControllerRoute(
    name: "default",
    pattern: "{controller=Home}/{action=Index}/{id?}");

app.Run();

Create a Model

A model is a representation of the data that our application will use and manipulate. By creating a model, we define the structure of the data and its relationships with other models. This allows us to easily work with data in our application and perform CRUD (Create, Read, Update, Delete) operations on it.

using System.ComponentModel.DataAnnotations;

namespace Asp.netcore_Tutorials.Models
{
    public class Customers
    {
        [Key]
        public int id { get; set; }
        public string fullName { get; set; }
        public string customertype { get; set; }
        public Guid GetGuid { get; set; }
    }
}

Migration

Run Migration

  • Add-Migration ‘Initial Create’
  • Update-Database

Create a Controller

A controller is responsible for handling HTTP requests, performing business logic, and returning HTTP responses. By creating a controller, we define the endpoints of our application and how they respond to client requests. This enables us to build a functional and responsive web application with the desired behavior.

using Asp.netcore_Tutorials.Models;
using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Mvc;

namespace Asp.netcore_Tutorials.Controllers
{
    public class DataInsertefFastController : Controller
    {
        private readonly EfCoreContext _custdbcontext;
        private TimeSpan TimeSpan;

        public DataInsertefFastController(EfCoreContext custDbcontext)
        {
            _custdbcontext = custDbcontext;
        }
        public async Task<IActionResult> Index()
        {

            List<Customers> Cust_List = new();
            DateTime counterstart = DateTime.Now;

            for ( int k=0; k< 150000; k++)
            {
                Cust_List.Add(new Customers()
                {
                       fullName =  "Custmer_" + k,
                       customertype = "Customer_Type_" + k ,
                       GetGuid  = Guid.NewGuid()
                });
            }
            await _custdbcontext.BulkInsertAsync(Cust_List);         
            TimeSpan = DateTime.Now - counterstart;

            return View();
        }
    }
}
Document

More Related Posts

Fast Insert Entity Framework Core

The post Fast Insert with Entity Framework Core in ASP.NET Core appeared first on Tech Insights.

]]>
https://reactconf.org/fast-insert-ef-core-aspnet-core/feed/ 0 1207
How to Find Duplicate Records Using Entity Framework in Asp.net Core https://reactconf.org/how-to-find-duplicate-records-using-entity-framework-in-asp-net-core/ https://reactconf.org/how-to-find-duplicate-records-using-entity-framework-in-asp-net-core/#respond Sat, 22 Apr 2023 09:38:45 +0000 https://labpys.com/?p=1131 This task is fortunately simple because of Entity Framework in ASP.NET Core. We will look at How to Find Duplicate Records Using Entity Framework in Asp.net Core in this post. …

The post How to Find Duplicate Records Using Entity Framework in Asp.net Core appeared first on Tech Insights.

]]>
This task is fortunately simple because of Entity Framework in ASP.NET Core. We will look at How to Find Duplicate Records Using Entity Framework in Asp.net Core in this post.

A database with duplicate records can be very problematic for your application. They may produce inaccurate results, use storage space, and impair the functionality of the application. Due to this, it’s crucial to be able to rapidly and effectively detect and get rid of duplicate records.

Introduction

For .NET developers, Entity Framework is a potent Object-Relational Mapping (ORM) tool. It may assist you with operations like querying, updating, and removing data in a database and enables you to work with databases using strongly-typed.NET objects. This post will concentrate on using Entity Framework to identify and get rid of redundant records in a database.

Understanding Duplicate Records

When two or more rows in a database table have the same values for every column, duplicate entries are created. Multiple things, including data entry errors, software problems, and hardware issues, might result in duplicate records. Duplicate records might make it harder for your application to acquire accurate data from the database, which can lead to issues.

Install Required Software

  • NET Core SDK from here
  • Visual Studio or Visual Studio Code from here

Setup the Project

Make sure we have a functioning ASP.NET Core project with Entity Framework installed before we begin. You can start a new project in Visual Studio or by using the dotnet new command if you don’t already have one.

Add the Entity Framework Core package to your project once it has been configured. Run the following command in the Package Manager Console to accomplish this:

Install-Package Microsoft.EntityFrameworkCore

Find Duplicate Records Using Entity Framework in Asp.net Core

In Entity Framework, there are numerous methods for locating duplicate records. Below, we’ll look at a few of the more popular techniques.

Sample Data

 List<Employee> Employees = new List<Employee>
        {
         new Employee{ EmpId= 1, FirstName = "Vicky",LastName= "Pointing" },
         new Employee{ EmpId= 2, FirstName = "John",LastName= "Astle" },
         new Employee{ EmpId= 3, FirstName = "Vicky",LastName= "Pointing" },
         new Employee{ EmpId= 4, FirstName = "Fleming",LastName= "Mick" },
         new Employee{ EmpId= 5, FirstName = "Vicky",LastName= "Pointing" },
         new Employee{ EmpId= 6, FirstName = "Jonty",LastName= "M" },
         new Employee{ EmpId= 7, FirstName = "Vicky",LastName= "Pointing" },
         new Employee{ EmpId= 8, FirstName = "Fleming",LastName= "Mick" }
        };

Group By

The GroupBy approach is one way to identify duplicate records. Based on a given key, this method groups the table’s rows and returns the groups as a collection. We can group the rows by the columns we want to check for duplicates in order to discover duplicate records, and then filter the groups that contain more than one row.

   public IActionResult Index()
        {

            var Employee = Employees.GroupBy(d => new { d.FirstName, d.LastName })
                .Where(g => g.Count() > 1).Select(g => new { g.Key.FirstName, g.Key.LastName });

            ViewBag.DupRecord = Employee;

            return View();
        }
    }
Document

According to columns FirstName and LastName, the rows in the Employee table are grouped by this code, which then filters the groups with more than one row. A list of groups with duplicate records is the outcome.

Using Any

The Any approach is an additional technique for locating duplicate entries. If any element in a sequence matches a given criterion, this method returns true. We can use the Any method to see if any rows in a table meet the requirements for duplicate records in order to find duplicate records. Here’s an illustration:

  public IActionResult Index()
        {
 
             var dupemployee = Employees.GroupBy(d => new { d.FirstName, d.LastName })
               .Any(g => g.Count() > 1);                

            

            return View();
        }

The Any method is used to determine whether any groups of rows in the Employee table that are grouped by Columns FirstName and LastName have more than one row. The outcome is a boolean value that denotes if the table contains duplicate records.

Conclusion

In this post, we looked at numerous methods for finding duplicate records in ASP.NET Core using Entity Framework. You can quickly and efficiently detect and eliminate duplicate records in your database by using the methods outlined here. This will help to ensure that your application functions properly and gives accurate data to your users.

The post How to Find Duplicate Records Using Entity Framework in Asp.net Core appeared first on Tech Insights.

]]>
https://reactconf.org/how-to-find-duplicate-records-using-entity-framework-in-asp-net-core/feed/ 0 1131
How to Create Dynamic Menu in Asp.Net Core MVC C# https://reactconf.org/how-to-create-dynamic-menu-in-asp-net-core-mvc-c/ https://reactconf.org/how-to-create-dynamic-menu-in-asp-net-core-mvc-c/#comments Tue, 10 Jan 2023 17:38:23 +0000 https://labpys.com/?p=643 In this article, we will learn How to Create a Dynamic Menu in Asp.Net Core MVC C#. In the previous article, we discussed https://labpys.com/how-to-generate-qr-code-using-asp-net-core-c/. Prerequisites Create an ASP.NET Core MVC …

The post How to Create Dynamic Menu in Asp.Net Core MVC C# appeared first on Tech Insights.

]]>
In this article, we will learn How to Create a Dynamic Menu in Asp.Net Core MVC C#. In the previous article, we discussed https://labpys.com/how-to-generate-qr-code-using-asp-net-core-c/.

Dynamic Menu in Asp.Net Core MVC C#

Prerequisites

  • Download and install .Net Core 6.0 SDK from here
  • Download and Install Microsoft Visual Studio 2022 from here
  • Sql-Server

Create an ASP.NET Core MVC Project

Open visual studio, Go to File menu and click on New and select Project. Then new project window, select ASP.NET Core Web Application (Model-View-Controller) template.

Dynamic Menu in Asp.Net Core MVC C#

Enter  project name and click create.

Dynamic Menu in Asp.Net Core MVC C#

Install NuGet Packages

  • Microsoft Entity Framework Core Sql Server.
  • Microsoft Entity Framework Core Tools

Configure appsettings.json

There are two connection string one is SQL Server and another one is excel .

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "ConnectionStrings": {
    "sqlconnection": "Server=(local)\\MSSQL;Database=InventoryDB;Trusted_Connection=True;MultipleActiveResultSets=true",   
    
  },
  "AllowedHosts": "*"
}

Create Model

Create Model class and DbContext Class.

//MenuMast.cs

using DocumentFormat.OpenXml.Presentation;
using System.ComponentModel.DataAnnotations;

namespace Asp.netcore_Tutorials.Models
{
    public class MenuMast
    {
        public MenuMast()
        {
            SubMenuMast = new HashSet<SubMenuMast>();
        }

        [Key]
        public int MenuCode { get; set; }

        [Required]
        [StringLength(250)]
        public string MenuName { get; set; }

        [StringLength(10)]
        public string DesignCodeTime { get; set; }

        public int? MenuSortOrder { get; set; }

        public virtual ICollection<SubMenuMast> SubMenuMast { get; set; }

    }
}

SubMenuMast.cs

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Asp.netcore_Tutorials.Models
{
    public class SubMenuMast
    {
        
        [Key]
        public int SubMenuCode { get; set; }

        public int ModuleCode { get; set; }
     
        [Required]
        [StringLength(150)]
        public string SubMenuName { get; set; }

        [StringLength(150)]
        public string TableName { get; set; }

        public bool HideFlag { get; set; }

        public int? SubMenuSortOrder { get; set; }

        public int MenuCode { get; set; }
        [ForeignKey(nameof(MenuCode))]
        public virtual MenuMast MenuMasts { get; set; } 
    }
}

MenuDbcontext.cs

using Microsoft.EntityFrameworkCore;

namespace Asp.netcore_Tutorials.Models
{
    public class MenuDbcontext : DbContext 
    {
        public MenuDbcontext(DbContextOptions<MenuDbcontext> option):base(option)
        {

        }

        public virtual DbSet<MenuMast> MenuMasts { get; set; }
        public virtual DbSet<SubMenuMast> SubMenuMasts { get; set; }
   
    }
}

Create Interface and Concrete Class

Interface IMenuNavigation.cs

using Asp.netcore_Tutorials.Models;

namespace Asp.netcore_Tutorials.Repository
{
    public interface IMenuNavigation
    {
        Task<IEnumerable<SubMenuMast>> MenuList();
        Task<IEnumerable<MenuMast>> MenuMastList();             
    }
}

Concrete Class MenuNavigation.cs

using Asp.netcore_Tutorials.Models;
using Microsoft.EntityFrameworkCore;
using System.Collections;

namespace Asp.netcore_Tutorials.Repository
{
    public class MenuNavigation : IMenuNavigation
    {
        private readonly MenuDbcontext _menuDbcontext;

        public MenuNavigation(MenuDbcontext menuDbcontext)
        {
            _menuDbcontext = menuDbcontext;
        }
        public async Task<IEnumerable<SubMenuMast>> MenuList()
        {
            return await _menuDbcontext.SubMenuMasts.Include(m=>m.MenuMasts).ToListAsync();
        }
        public async Task<IEnumerable<MenuMast>> MenuMastList()
        {
             return await _menuDbcontext.MenuMasts.Include(m=>m.SubMenuMast).ToListAsync();
        }
    }
}

Configure Program.cs

using Asp.netcore_Tutorials.Models;
using Asp.netcore_Tutorials.Repository;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using System.Configuration;
using Microsoft.AspNetCore.Session;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddControllersWithViews();

 
builder.Services.AddDbContext<MenuDbcontext>(conn => conn.UseSqlServer(builder.Configuration.GetConnectionString("sqlconnection")));
 
builder.Services.AddScoped<IMenuNavigation, MenuNavigation>();

builder.Services.AddSession();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Home/Error");
    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
    app.UseHsts();
}

app.UseHttpsRedirection();

app.UseStaticFiles();

app.UseRouting();

app.UseAuthorization();

app.UseSession();

app.MapControllerRoute(
    name: "default",
    pattern: "{controller=Home}/{action=Index}/{id?}");

app.Run();

Migration

Add-Migration 'Initial-Create'
Update-Database

Create View Model

menuViewModel.cs

using Asp.netcore_Tutorials.Models;

namespace Asp.netcore_Tutorials.ViewModel
{
    public class menuViewModel
    {
      //  public  ICollection<SubMenuMast> menuListViewModel { get; set; }
        public IEnumerable<MenuMast> MenuList { get; set; }
    }
}

Create Controller

MenuController.cs

using Asp.netcore_Tutorials.Repository;
using Microsoft.AspNetCore.Mvc;
using Asp.netcore_Tutorials.ViewModel;
using Microsoft.AspNetCore.Mvc.Rendering;
using Asp.netcore_Tutorials.Models;

namespace Asp.netcore_Tutorials.Controllers
{
    public class MenuController : Controller
    {
        private readonly IMenuNavigation _menuList;

        public MenuController(IMenuNavigation menuList)
        {
            _menuList = menuList;
        }

        public IActionResult Index()
        {
            menuViewModel menuListViewModel = new menuViewModel();     
            menuListViewModel.MenuList =  _menuList.MenuMastList().Result.ToList();
            return View(menuListViewModel);
        }
    }
}

Customize View

index.cs

 
@model Asp.netcore_Tutorials.ViewModel.menuViewModel;
 
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">

        <title></title>

        <!-- Bootstrap CSS CDN -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
        <!-- Our Custom CSS -->
      
        <!-- Scrollbar Custom CSS -->
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.css">

         
       <link href="~/css/style.css" rel="stylesheet" />

    </head>
    <body>
        <div class="wrapper">
            <!-- Sidebar Holder -->
            <nav id="sidebar">
                <div class="sidebar-header">
                    <h3>Dynamic Menu</h3> 
                </div>

                <ul class="list-unstyled components">
                 @foreach (var menu in Model.MenuList)
                 {
                  <li class="active">
                        <a href="#@menu.MenuName" data-toggle="collapse" aria-expanded="false" class="dropdown-toggle">@menu.MenuName</a>
                    <ul class="collapse list-unstyled" id="@menu.MenuName">
                       @if (@menu.SubMenuMast.Count > 0)
                            {
                                @foreach (var item in menu.SubMenuMast)
                                {
                                    <li><a href="@item.SubMenuName">@item.SubMenuName</a></li>
                                }; 
                            };                     
                    
                    </ul>
                    </li>
                   };
                  </ul>              
            </nav>

            <!-- Page Content Holder -->
            <div id="content">

                <nav class="navbar navbar-default">
                    <div class="container-fluid">

                        <div class="navbar-header">
                            <button type="button" id="sidebarCollapse" class="btn btn-info navbar-btn">
                                <i class="glyphicon glyphicon-align-left"></i>
                                <span>Toggle Sidebar</span>
                            </button>
                        </div>

                        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                            <ul class="nav navbar-nav navbar-right">
                                <li><a href="#">Page</a></li>
                            </ul>
                        </div>
                    </div>
                </nav>

            
            </div>
        </div>

         <!-- jQuery CDN -->
    <script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
    <!-- Bootstrap Js CDN -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <!-- jQuery Custom Scroller CDN -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.concat.min.js"></script>
 
 
    <script type="text/javascript">
        $(document).ready(function () {

            $('#sidebarCollapse').on('click', function () {
                $('#sidebar').toggleClass('active');
            });

        });
    </script>
    </body>
</html>

 

The post How to Create Dynamic Menu in Asp.Net Core MVC C# appeared first on Tech Insights.

]]>
https://reactconf.org/how-to-create-dynamic-menu-in-asp-net-core-mvc-c/feed/ 2 643