Multiselect listbox

Hi I have a grid control with a listbox and multiselect checkbox asp/net MVC 5 ef6 CRUD using Json

 col.Field("Group").HeaderText("Group").EditType(EditingType.DropdownEdit).DropDownEditOptions(new DropDownListProperties(){ShowCheckbox = true}).DataSource((IEnumerable<object>)ViewData["DropDownGroupReference"]).CssClass("edmund").Width(150).Add();

The group field is a string

When I select multiple groups the are displayed as group1,group2 etx but when I look at model returned to controller update or insert there is only one group value returned to controller.

How do I get multiple selected groups returned to controller

Thanks

4 Replies

MP Manivannan Padmanaban Syncfusion Team July 9, 2018 02:25 PM UTC

Hi Edmund, 

Thanks for contacting syncfusion support. We are happy to assist you. 

We have achieved your requirement by using actionBegin event of ejgrid. Please refer the below code example. 



@(Html.EJ().Grid<object>("FlatGrid") 
           .Datasource(ds => 
           { 
               ds.Json((IEnumerable<object>)ViewBag.datasource) 
               .UpdateURL("/Grid/ForeignKeyUpdate") 
               .InsertURL("/Grid/ForeignKeyInsert") 
               .RemoveURL("/Grid/ForeignKeyDelete") 
               .Adaptor(AdaptorType.RemoteSaveAdaptor); 
           }) 
            .EditSettings(edit => 
            { 
                edit.AllowAdding() 
                    .AllowDeleting() 
                    .AllowEditing(); 
            }) 
             
            .Columns(col => 
            { 
                 
                col.Field("CustomerID").HeaderText("First Name") 
                  .EditType(EditingType.DropdownEdit).DataSource((IEnumerable<object>)ViewBag.datasource2).DropDownEditOptions(new DropDownListProperties() { DropDownListFields = { Text = "FirstName", Value = "FirstName" }, ShowCheckbox = true }) 
                   .Width(90) 
                   .Add(); 
            }) 
.ClientSideEvents(eve => 
{ 
    eve.ActionBegin("actionBegin"); 
}) 
) 
<script> 
    function actionBegin(args) { 
        if (args.requestType == "save") { 
            args.data.CustomerID = args.data.hiddenEle; 
        } 
    } 
 
    
</script> 





After referring the above code still facing the issue please share the following details, 

  1. Share the grid edit mode.
  2. Share the essential studio version.
  3. Share the complete grid code example.

Regards, 

Manivannan Padmanaban. 





EH Edmund Herbert July 9, 2018 03:23 PM UTC

Hi could you send me an example of what you propose


EH Edmund Herbert July 9, 2018 04:32 PM UTC

Hi please ignore previous message i have it working thsnks for speedy reply you guys arestars


TS Thavasianand Sankaranarayanan Syncfusion Team July 10, 2018 11:53 AM UTC

Hi Edmund, 

Thanks for the update. 

Please get back to us if your require further assistance on this. 

Regards, 
Thavasianand S. 


Loader.
Up arrow icon