0
votes

I have a database without the relations between tables in SQL Server, but the data are relationated.

I am trying to use a Kendo Grid with Foreign Key column, but, the example that I found is for database with correctly related tables.

How I can declare a Kendo Grid when for a Foreign Key column I said who is the Action and Controller to fill this data.

1
Do you have an entity or object model? Are you using some sort of ORM? - Matt Millican
I am using Entity Framework. - dennitorf
It shouldn't matter if your database has the FKs or not. It's more important that your objects are linked together through navigational properties. - Matt Millican

1 Answers

0
votes

IMHO, you may do like this:

Let's say we create a foreign key column about gender

col.ForeignKey(m => m.id_gender, (System.Collections.IEnumerable)ViewData["gender"], "id_gender", "description");

In the controller, we may create a ienumerable collection then pass it back to the view using view data

IEnumerable<GenderItem> gender_list = .... <-- initiallize the ienumerable or get from database
ViewData["gender"] = gender_list;