Mithun Pradhan

Mithun Pradhan

  • 1.6k
  • 150
  • 21k

ejs-dropdownlist asp-for validation not working

Nov 15 2021 12:09 PM

<form method="post" asp-page-handler="SaveCarDetails">

<ejs-dropdownlist id="dropdownAddressTypeFilters" change="valueChange" ejs-for="CarViewModel.AddressTypeList.SelectedValue"

                      dataSource="@Model.CarViewModel.AddressTypeList.Items" popupHeight="300px"

                      placeholder="Select Address Type" allowFiltering="true">

<e-dropdownlist-fields text="Text" value="Value" iconCss="Text"></e-dropdownlist-fields>

</ejs-dropdownlist>

<span asp-validation-for="CarViewModel.AddressTypeList.SelectedValue" class="validation-summary-errors text-danger"></span>

<input id="BtnSave" type="submit" class="rmbttn" value="Save" />

</form>

public class DropDownListViewModel<T>

    {

        public SelectList Items { get; set; }

        [Required(ErrorMessage = "Please select a value from the list")]

        public T SelectedValue { set; get; }

    }

??


Answers (2)