ejs-dropdownlist asp-for validation not working

<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; }

    }




1 Reply

BC Berly Christopher Syncfusion Team November 15, 2021 12:45 PM UTC

Hi Mithun, 
  
Greetings from Syncfusion support. 
  
We have checked the shared code example and ejs-for validation in DropDownList component is working fine at our end. So, we have prepared the sample and attached it below. 
  
  
Screenshot: 
 
  
Please refer the below documentation and demo link for know more about DropDownList For validation. 
  
  
Regards, 
Berly B.C 


Loader.
Up arrow icon