grid dropdownedit column

Hello. I'm using ASP .NET Core and Syncfusion.EJ2
I use colunm with EditType 'dropdownedit', ForeignKeyField and ForeignKeyValue:

col.Field("CustomerID").ForeignKeyField("CustomerID").ForeignKeyValue("CustomerName").DataSource(
                   (IEnumerable<object>)ViewBag.dataSource2).EditType("dropdownedit").HeaderText("Customer Name").Width("150").Add()

in viewmode it's ok, but in edit mode dropdownlist contain a list of CustomerID, not a list of customer names

What a'm doing wrong? Thx

1 Reply

DR Dhivya Rajendran Syncfusion Team March 20, 2018 01:16 PM UTC

Hi Ivashko, 

Thanks for contacting Syncfusion Support, 
We have validated your requirement, By default we have dropdown edit option for foreignKey columns, so could you please remove the EditType("dropdownedit") in your sample, its resolve your problem, kindly please refer the below code snippet for more information, 
  @Html.EJS().Grid("ForeignKey").DataSource((IEnumerable<object>)ViewBag.datasource).AllowFiltering().Columns(col => 
   { 
 
col.Field("CustomerID").ForeignKeyField("CustomerID").ForeignKeyValue("CustomerName").DataSource( 
                   (IEnumerable<object>)ViewBag.dataSource2).HeaderText("Customer Name").Width("150").Add() 
      . . . . . . . 
   }). Render() 

 

Regards,
R.Dhivya 


Loader.
Up arrow icon