Hi
How to get and show data in MultiLevel Tree View in ASP.NET Core MVC through ADO.net?
CREATE TABLE [dbo].[VehicleSubType](
[Id] [int] NOT NULL,
[Name] [varchar](50) NULL,
[VehicleTypeId] [int] NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[VehicleLevelType](
[Id] [int] NOT NULL,
[Name] [varchar](50) NOT NULL,
[VehicleTypeId] [int] NOT NULL,
[VehicleSubTypeId] [int] NOT NULL,
[VehicleTypeName] [varchar](50) NULL,
CONSTRAINT [PK_VehicleLevelType] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
go
CREATE TABLE [dbo].[VehicleType](
[Id] [int] NOT NULL,
[Name] [varchar](50) NULL
) ON [PRIMARY]
GO
INSERT [dbo].[VehicleLevelType] ([Id], [Name], [VehicleTypeId], [VehicleSubTypeId], [VehicleTypeName]) VALUES (1, N'Bus1.1', 1, 1, N'Bus1')
INSERT [dbo].[VehicleLevelType] ([Id], [Name], [VehicleTypeId], [VehicleSubTypeId], [VehicleTypeName]) VALUES (2, N'Bus1.2', 1, 1, N'Bus1')
INSERT [dbo].[VehicleLevelType] ([Id], [Name], [VehicleTypeId], [VehicleSubTypeId], [VehicleTypeName]) VALUES (3, N'Bus1.3', 1, 1, N'Bus1')
INSERT [dbo].[VehicleLevelType] ([Id], [Name], [VehicleTypeId], [VehicleSubTypeId], [VehicleTypeName]) VALUES (4, N'Bus2.1', 1, 2, N'Bus2')
INSERT [dbo].[VehicleLevelType] ([Id], [Name], [VehicleTypeId], [VehicleSubTypeId], [VehicleTypeName]) VALUES (5, N'Bus2.2', 1, 2, N'Bus2')
INSERT [dbo].[VehicleLevelType] ([Id], [Name], [VehicleTypeId], [VehicleSubTypeId], [VehicleTypeName]) VALUES (6, N'Bus2.3', 1, 2, N'Bus2')
INSERT [dbo].[VehicleLevelType] ([Id], [Name], [VehicleTypeId], [VehicleSubTypeId], [VehicleTypeName]) VALUES (7, N'Bus3.1', 1, 3, N'Bus3')
INSERT [dbo].[VehicleLevelType] ([Id], [Name], [VehicleTypeId], [VehicleSubTypeId], [VehicleTypeName]) VALUES (8, N'Bus3.2', 1, 3, N'Bus3')
INSERT [dbo].[VehicleLevelType] ([Id], [Name], [VehicleTypeId], [VehicleSubTypeId], [VehicleTypeName]) VALUES (9, N'Bus3.3', 1, 3, N'Bus3')
INSERT [dbo].[VehicleSubType] ([Id], [Name], [VehicleTypeId]) VALUES (1, N'Bus1', 1)
INSERT [dbo].[VehicleSubType] ([Id], [Name], [VehicleTypeId]) VALUES (2, N'Bus2', 1)
INSERT [dbo].[VehicleSubType] ([Id], [Name], [VehicleTypeId]) VALUES (3, N'Bus3', 1)
INSERT [dbo].[VehicleSubType] ([Id], [Name], [VehicleTypeId]) VALUES (4, N'Truck1', 2)
INSERT [dbo].[VehicleSubType] ([Id], [Name], [VehicleTypeId]) VALUES (5, N'Truck2', 2)
INSERT [dbo].[VehicleSubType] ([Id], [Name], [VehicleTypeId]) VALUES (6, N'Truck3', 2)
INSERT [dbo].[VehicleSubType] ([Id], [Name], [VehicleTypeId]) VALUES (7, N'Micro1', 3)
INSERT [dbo].[VehicleSubType] ([Id], [Name], [VehicleTypeId]) VALUES (8, N'Micro2', 3)
INSERT [dbo].[VehicleSubType] ([Id], [Name], [VehicleTypeId]) VALUES (9, N'Micro3', 3)
INSERT [dbo].[VehicleType] ([Id], [Name]) VALUES (1, N'Bus')
INSERT [dbo].[VehicleType] ([Id], [Name]) VALUES (2, N'Truck')
INSERT [dbo].[VehicleType] ([Id], [Name]) VALUES (3, N'Micro')
Thank You!