﻿@model string[]
@Html.DropDownList("[]", new SelectListItem[0])

<script type="text/javascript">
    $(function () {
        $.ajax({
            url: '@Url.Action("Rooms", "Select")',
            method: 'post',
            success: function(data) {
                $("#@Html.IdForModel()__")
                    .select2({
                        data: data
                    }).val("@((Model ?? new string[0]).FirstOrDefault())").trigger('change');
            }
        });
    });
</script>

﻿@model string[]
@Html.DropDownList("[]", new SelectListItem[0], new { multiple="multiple" })

<script type="text/javascript">
    $(function () {
        $.ajax({
            url: '@Url.Action("Rooms", "Select")',
            method: 'post',
            success: function(data) {
                $("#@Html.IdForModel()__")
                    .select2({
                        data: data
                    }).val("@((Model ?? new string[0]).FirstOrDefault())").trigger('change');
            }
        });
    });
</script>

Make rooms multi-select for devices (and clearable)
Make rooms multi-select for devices (and clearable)
