We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Cell dropdown displaying model value

I have a grid bound to a local list of JS objects.
One of the grid cells is defined to be a dropDown list which is bound to another local list of JS object. The object is mapped to this C# class:

class Tax
int id {set;get;}
string name{set;get;}

When the grid is displayed and not in edit mode, i expect it to show the tax value as a string representing the name of the tax (ex: Local, Export ...), but i am getting the id of the tax displayed instade.
Here is how i define the dropdown:

List<CrescendoPMS.Models.Country> ctries = CrescendoPMS.Models.Country.Get(); // This is for showing purpose only, in reality, the controller is getting the values from the model class
    var dropDown = new Syncfusion.EJ2.DropDowns.DropDownList()
        DataSource = ctries,
        Query = "new ej.data.Query()",
        Fields = new Syncfusion.EJ2.DropDowns.DropDownListFieldSettings { Value = "id", Text = "name" },         

and in the grid i have this:
col.Field(nameof(CrescendoPMS_BL.Models.invoice_line.tax_id)).EditType("dropdownedit").Edit(new { @params = dropDown }).HeaderText("Tax").Add();

My edit settings are as follow:

EditSettings(e => e.ShowConfirmDialog(false).Mode(Syncfusion.EJ2.Grids.EditMode.Batch).AllowAdding(true).AllowDeleting(true).AllowEditing(true).AllowEditOnDblClick(true).NewRowPosition(Syncfusion.EJ2.Grids.NewRowPosition.Bottom)

Thank you for your help.

2 Replies

FH Fayçal HANNOUN December 24, 2019 08:36 PM UTC

I was able to achieve what i was looking for.
This works like a charm and as expected

Thank you.

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team December 30, 2019 06:01 AM UTC

Hi Faycal,

Thanks for the update.

We are happy to hear that your requirement has been acheived and you are good to go.

Seeni Sakthi Kumar S 

Live Chat Icon For mobile
Up arrow icon