[MVC 5] Populate my select listbox with the values selected

I need to to edit some registries but i havent managed to fill the select with the associated options for each registry.
Im doing this in an MVC 5 project.

This is my ListBox:

<div>
    @Html.ListBoxFor(x => x.Recursos.SelectedValues, (SelectList)ViewBag.ListaRecursos, new { @class = "form-control select2", @id = "test", @multiple = "multiple", @style="width: 100%", @Name = "nome"})
</div>

But i cant even fill it like this
$('#test').val('hi')

Is this for a particular framework/integration? If so, please tell us which one, so that someone else familiar with the technology can find this and potentially help you.

Its a simple MVC 5 project, i’ve edited the post with that info. Thanks

Try $('#test').select2(). That works here.

I might’ve explained myself wrong. The select list is populated with all the values. I can create an event with them. What i want is when i edit that event i can see all of them but the ones i chose to be selected.