BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
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.
Thanks
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 11.4.0.26
Hi John
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)
.TextAlign(TextAlign.Left).Width(90).Add(); } .Render()) |
For the Online Sample of foreign key column binding, please
refer the following link:
http://mvc.syncfusion.com/demos/web/Grid/ForeignKeyColumn
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.
Regards
Ragavee U S
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.
http://mvc.syncfusion.com/demos/web/Grid/ForeignKeyColumn
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.
https://s3.amazonaws.com/files2.syncfusion.com/Installs/v12.1.0.43/ReleaseNotes/ASPMVCClassic.html
Please let us know if you need any further assistance.
Regards,
Alan Sangeeth S