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

How to display description based on code.

I have a grid which displays the contents of a SQL Table. The problem is because our database is normalized it shows a code instead of the value that is in another table. For example the table has a column named location which is an integer value. This location field is the key for a value in the Location table. The Location table has two fields the primary key and the Description. My grid shows something like this:

Equipment         Location
2040170             1

What I'd like it to show is this:
Equipment          Location
2040170              Third Floor Conference Room

I have been able to set the location column to be a Dropdown and filled it with the values from the Location Table. The problem is I would like the location column to show the Description from the Location table but store the Location key in the Equipment table.


3 Replies

JJ John Jacobs May 13, 2014 04:32 AM UTC

My column doesn't have a field for ForeignKey or ForeignValue.  I also note the you are using @Html.EJ() I am using @Html.Syncfusion().  Is EJ a different package than Syncfusion Essential Studio. Or is the ForeignKey in a more current version of Syncfusion Essential Studio. I'm using

RU Ragavee U S Syncfusion Team May 13, 2014 04:32 AM UTC

Hi John

Thanks for using Syncfusion Products.

We have analyzed your requirement and suspect that the cause of the issue is we have to bind the column Location with the ForeignKeyValue property.


Please refer the below code snippet.


@(Html.EJ().Grid<Object>("ForeignKey")        .Datasource((IEnumerable<object>)ViewBag.dataSource1)

.Columns(col =>


. . .

col.Field("Location").HeaderText("Location").ForeignKeyField("Location")               .ForeignKeyValue("Description").DataSource((IEnumerable<object>)ViewBag.dataSource2)





For the Online Sample of foreign key column binding, please refer the following link:



For your convenience, we have created a simple sample using foreign key column and the same can be downloaded from the attachment.


Please let us know if you need any further assistance.



Ragavee U S

Attachment: Sampl116288_112fa4de.zip

AS Alan Sangeeth S Syncfusion Team May 13, 2014 05:40 AM UTC

Hi John,

Thanks for the update.

Query 1: “Foreign key value”

We do not have support for “Foreign key value” in Asp.net MVC classic Grid. We have logged this as a feature request in our database. We will implement this feature in any of our upcoming releases. We usually have an interval of at least three months between releases. The feature implementation would also greatly depend on the factors such as product design, code compatibility and complexity.

Also if you want, you can migrate to Asp.net MVC Grid(EJ Grid) as it has foreign key value support. Please refer the following link for the Online Sample of foreign key column binding.


Query 2: “Is EJ a different package than Syncfusion Essential Studio”

We would like to let you know that Asp.net MVC Grid(EJ Grid) is the newer set of controls powered by Essential JavaScript. Please refer the ‘Information Section’ of following link to get to know about controls powered by Essential JavaScript.


Please let us know if you need any further assistance.

Alan Sangeeth S

Live Chat Icon For mobile
Up arrow icon