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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Cell dropdown displaying model value

Thread ID:

Created:

Updated:

Platform:

Replies:

150185 Dec 24,2019 05:03 PM UTC Dec 30,2019 06:01 AM UTC ASP.NET MVC - EJ 2 2
loading
Tags: Grid
Fayçal HANNOUN
Asked On December 24, 2019 05:03 PM UTC

Hello,
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.


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

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

Thank you.

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On 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.

Regards.  
Seeni Sakthi Kumar S 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon