An open API service indexing awesome lists of open source software.

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

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)
![Parent Dropdown Triggers Child](_assets/changingddl.gif)

## 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