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