GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - codedcontainer/BlazorSelectListComponents: Blazor list components for handlling internal or JSON data

BranchesTags
Open more actions menu

Latest commit

 

History

2 Commits
2 Commits

Folders and files

NameName
Last commit message
Last commit date
Components
Components
 
 
Models
Models
 
 
Pages
Pages
 
 
Properties
Properties
 
 
Shared
Shared
 
 
wwwroot/css
wwwroot/css
 
 
.gitignore
.gitignore
 
 
App.razor
App.razor
 
 
BlazorSelectList.csproj
BlazorSelectList.csproj
 
 
BlazorSelectList.sln
BlazorSelectList.sln
 
 
Program.cs
Program.cs
 
 
Readme.md
Readme.md
 
 
_Imports.razor
_Imports.razor
 
 
appsettings.Development.json
appsettings.Development.json
 
 
appsettings.json
appsettings.json
 
 

Repository files navigation

Blazor Select List Components

Select List Component

Description

A Blazor select list component styled using Bootstrap 5. This component uses reflection and a generic list of objects to create a <select> element and nested <option> elements.

How To Run

  • Make sure to have .net 7 framework runtime installed on your machine
  • Make sure to have dotnet cli installed
  • Run dotnet run from inside of the BlazorSelectList directory

Example

 <SelectListCustom 
    Data=People
    TextKey="Name"
    ValueKey="Id"
    DefaultText="-- Select a Person --"
    DefaultValue="-1"
    SelectedOptionByValue="2"
    Name="People">
</SelectListCustom>

Attributes

Attribute Desc Required?
Data List of generic objects. Example: var People = List<Person>. Y
ValueKey Object property key that assigns each option's value attribute. Example: <option value={ValueKey.Value}>... Y
TextKey Object property key that assigns each option's text value. Example: <option ...>{TextKey.Value}>.... Y
DefaultText Prepends a new option element and assigns the options text value. N
DefaultValue Sets the prepended option element's value. N
SelectedOptionByValue Sets an option element to 'selected' by a matching option value attribute. N

Select List JSON Component

Description

This component works similarly to the select list component but handles a serialized JSON string instead of a list of generic C# objects.Deserialization the JSON string uses C# JSON DOM and JsonNode.

Example

<SelectListJson 
    JsonData=@PeopleJson 
    TextKey="Name" 
    ValueKey="Id" 
    DefaultText="-- Select a Person --" 
    DefaultValue="-1"
    SelectedOptionByValue="2">
</SelectListJson>

Attributes

Attribute Desc Required?
Data Serialized JSON array. Must be a single-dimensional array of objects. Example: "[{Id:1, Name: "Bob Smit},...]" Y
ValueKey Object property key that assigns each options value attributes value. Example: <option value={ValueKey.Value}>.... The value must not be undefined or null. Y
TextKey Object property key that assigns each option's text value. Example: <option ...>{TextKey.Value}>.... The value must not be undefined or null. Y
DefaultText Prepends a new option element and assigns the option's text value N
DefaultValue Sets the prepended option element's value. N
SelectedOptionByValue Sets an option element to 'selected' by a matching option value attribute N

About

Blazor list components for handlling internal or JSON data

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.