https://github.com/chfern/net-core-autolink-dropdown
⛓NuGet Package to aid linking parent dropdowns to child dropdowns
https://github.com/chfern/net-core-autolink-dropdown
asp-net-core nuget-package
Last synced: 8 days ago
JSON representation
⛓NuGet Package to aid linking parent dropdowns to child dropdowns
- Host: GitHub
- URL: https://github.com/chfern/net-core-autolink-dropdown
- Owner: chfern
- Created: 2019-09-27T06:23:29.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-01T08:14:36.000Z (almost 7 years ago)
- Last Synced: 2025-08-26T17:54:07.219Z (10 months ago)
- Topics: asp-net-core, nuget-package
- Language: C#
- Homepage:
- Size: 332 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NetCoreAutoLinkDropdown
## Description
NetCoreAutoLinkDropdown is a package to aid developers in linking several connected dropdowns (parent dropdown with child dropdowns)

## Installation (NuGet)
NetCoreAutoLinkDropdown is a NuGet package and is available to install via nuget.
```
PM> Install-Package NetCoreAutoLinkDropdown
```
## Setup
- First off, install the package in your application:
- Open Startup.cs, add:
```csharp
// ConfigureServices
services.AddTransient();
var assembly = typeof(NetCoreAutoLinkDropdown.DropdownProviderControllers.AutoLinkDropdownProviderController).GetTypeInfo().Assembly;
services.AddMvc().AddApplicationPart(assembly);
```
```csharp
// Configure
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
```
## Usage
This package consists of
Two main interfaces:
- ```DropdownItem```
Your model that will be rendered as dropdown should implement this interface
- ```SubDropdownItemProviderFactory```
Implement this in your model if your model also acts as a provider for another dropdown. (For parent dropdowns)
Helper class:
- ```Dropdown.From(IEnumerable)```
Converts list of dropdownItems into list of SelectListItems
Tag Helpers:
- ```html
```
Use this tag helper to render dropdown
- ```html
```
Use this tag helper to link parent dropdown to child dropdown(s). To include multiple child, you can use ';' as delimiter in *provider-for*
## Sample Code
Here's a very simple app to demonstrate the usage of this library
https://github.com/manizer/NetCoreAutoDropdownSample