Skip to content

[SOLVED] How to extend SelectList to have a default NullValueText #1847

Answered by stsrki
gac-noob asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, thanks for tying out the Blazorise.

  1. Select list is the right component for somewhat larger lists. Dropdown, from a UX perspective, should only be used for small menus.
  2. The only way currently is to add dummy item into your data list that will be at index 0.
  3. <Validations> should work just fine with a select list

There could be some problems with 2.. Browsers are not good with null or empty values when used in <option> element. For example if you have <SelectItem Value="null">"Please select a country"<SelectItem> it will get translated into something like:

The problem here is that element onchange will return "Please select a country" as an option value. This is just how browsers work…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gac-noob
Comment options

Answer selected by gac-noob
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants