onChanged doesn't work unless I remove data-control="select2
<select @onchange="OnChanged" class="form-select" data-control="select2" data-placeholder="Select an option">
>
@foreach (var main in mainCategory)
{
<option value="@main.MainCat">@main.DescAr</option>
}
</select>
Replies (1)
Hi,
Thank you for reaching out to us.
In Blazor you should handle selec2 elements differently, in your js code you can add the following global functions to get and set selec2 value.
getSelectedValues: function (elementId) {
return $("#" + elementId).val();
},
setSelectedValues: function (elementId, values) {
$("#" + elementId).val(values).trigger("change");
} Then you can trigger those functions in your component whenever you want to set or get selec2 value.
For more info check this thread:
Regards,
Lauris Stepanovs,
Keenthemes Support Team