Allerdings kann ich die Änderung im DOM durch Chrome-Entwicklungstools sehen.
Code: Select all
@Html.DropDownListFor(model => model.ProductAndServices,
Model.ProductsAndServices.Select(item => new SelectListItem
{
Value = item.Key.ToString(),
Text = item.Value,
Selected = item.Key == Model.ProductId,
}), htmlAttributes: new { @class = "form-control input-fields-normal dropdown-ie multiSelect", @id = "productAndServicesDDL", @multiple = "multiple", @placeHolder = "Select Products and Services", style = "width:300px; height:300px;" })
$(function () {
$('#productAndServicesDDL').change(function () {
}).multipleSelect({
width: '100%'
});
});
Code: Select all
var option = $('')
.attr('value', 199)
.text('Any Service XYZ')
.prop('selected', true);
Code: Select all
$('#productAndServicesDDL').append(option).change()
Code: Select all
$('#productAndServicesDDL').multiselect('refresh');