My app uses a database first approach as the database already exists. Thus the models are created when the database is updated. Any validation changes in the model will be overridden when the database is updated.
My question is, what is the best way of ensuring that a value is selected (value required) when using a SfDropDownList on the client-side, without having to add validations in the model?
My code is as follows:
<GridColumn Field="IncidentCategoryNavigation.Description" HeaderText="Description">
<EditTemplate>
<SfDropDownList TItem="DataAccess.Models.IncidentCategory" TValue="int?" DataSource="@dataCatList" CssClass="@Validate" Placeholder="Select..."
@bind-Value="@((context as DataAccess.Models.IncidentType).IncidentCategory)" ValidationRules=@(new ValidationRules{Required=true})>
<DropDownListFieldSettings Text="Description" Value="Id">
</DropDownListFieldSettings>
</SfDropDownList>
</EditTemplate>
</GridColumn>