Mvc FlexGrid DataMap binding

Posted by: reidar.lange on 31 March 2023, 12:37 am EST

  • Posted 31 March 2023, 12:37 am EST - Updated 31 March 2023, 12:39 am EST

    Fearly new to this. I am trying to create a combobox column specifying both key and displayvalue.

    For now I only use an empty List<KeyValuePair<string,string>> named test as datasource for the column.

    It will not compile and gives the following error

    **Severity Code Description Project File Line Suppression State

    Error CS1503 Argument 1: cannot convert from ‘System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<string, string>>’ to ‘System.Action<C1.Web.Mvc.Fluent.CollectionViewServiceBuilder>’ SWPP C:\Users\reidar.BAS\source\repos\ShipWeightPlussMVC\SWPP\Views\ItemFl\Index.cshtml 59 Active


    It fails here:

    .DataMap(dm => dm.DisplayMemberPath(“Key”).SelectedValuePath(“Value”).Bind(test))


    string statuses = ViewBag.Statuses;

    List<KeyValuePair<string, string>> test = new List<KeyValuePair<string, string>>();



                                bl => bl.InitialItemsCount(100)
                            .Filterable(f => f.DefaultFilterType(FilterType.Both))
                            .Columns(b =>
                                b.Add(cb => cb.Binding("ProjectID").Visible(false));
                                b.Add(cb => cb.Binding("UniqueNo").Visible(false));
                                foreach (var h in Model.Headers)
                                    if (h.InputSpec.Type == ShipWeightPlussMVC.Models.InputSpec.InputTypes.Edit)
                                        b.Add(cb => cb
                                        b.Add(cb => cb
                                        .DataMap(dm => dm.DisplayMemberPath("Key").SelectedValuePath("Value").Bind(test))


  • Posted 3 April 2023, 5:31 am EST


    For this, you should pass the proper list of objects of a class that has valid properties with DataType and it should be binding the properties can be set as DisplayMemberPath and SelectedValuePath.


    Manish Gupta

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels