I'm Using Dropdownlist for verticals and a Multiselect listbox for accounts and a button in a viewpage. When I change the dropdown(verticals) Multiselect listbox will be visible and populated with corresponding Accounts.when I'm selecting the items(Accounts) from multiselect listbox, I want get the selected values as comma separated values in a variable. I'm Using the following jQuery:

```
$(document).ready(function () {
    $('#acc').hide();
    $('#ddlacc').hide();          
    $('#smt').click(function () {                 
     var vertical=$('#vdropdown :selected').text();
     var selectedvalues = $('#ddlacc > :selected').map(function () { return $(this).val(); }).get().join(',');
     var account = $('#ddlacc > :selected').map(function () { return $(this).text(); }).get().join(','); 
    getGrid(vertical,account);
    });
});

```

here is the html helper i'm using for dropdown,

```
        <b>Vertical : </b>@Html.DropDownList("Var_Vertical", new SelectList(Model.lstTravelReadyEntities, "Var_Vertical", "Var_Vertical", Model.lstTravelReadyEntities), "         ", new { id = "vdropdown", @onchange = "javascript:GetAccounts(this.value);" })

```

Following is the function for populating multiselect listbox, 

```
     function GetAccounts() {
    var url = "/Home/Account/";
    $.ajax({
    url: url,
    data: {},
    cache: false,
    type: "POST",
    success: function (data) {
    var markup = "";
    for (var x = 0; x < data.lstTravelReadyEntities.length; x++) {
    markup += "<option value=" + x + ">" + data.lstTravelReadyEntities[x].Var_AccountName + "</option>";
    }
    $('#acc').show();
    $('#ddlacc').html(markup);                        
    $('#ddlacc').multiselect(); 
    },
    error: function (reponse) {
    alert("error : " + reponse);
    }        
    });        
}

```

Here i can get only last selected item in a variable(selectedvalues). What change i have to do for getting comma separated value in a variable(selectedvalues)?