This is a migrated thread and some comments may be shown as answers.

Entity Binding with CRUD and Relationships

4 Answers 126 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Christopher Haws
Top achievements
Rank 1
Christopher Haws asked on 19 Aug 2010, 07:15 PM
Hi All,

I'm currently trying to make a simple form using the ASP.NET Grid control and I am running into an issue. When I try to use CRUD with the Entity Framework, all the fields that are not relationships to other tables work great, but fields that are relationships don't show up at all. A great example is the Telerik example:
http://demos.telerik.com/aspnet-ajax/grid/examples/databinding/net35datasourcecontrols/defaultcs.aspx

In the second grid, the one that is bound to an Entity, you see that category shows up as an ID. I don't even get this much in my app. I see all the fields except for the Category field. Ideally it would show the name of the category, and then when you do any CRUD operations, it would show the field as a ComboBox.

Is this something that is even possible with the Telerik controls?


Thanks!

4 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 25 Aug 2010, 08:24 AM
Hello Christopher,

For your convenience I've prepared example demonstrating how to switch GridBoundColumn to GridDropDownColumn and have automatic CRUD operations function properly. Please find the attached application.

Regards,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Christopher Haws
Top achievements
Rank 1
answered on 25 Aug 2010, 10:57 PM
Hello Nikolay!

Thanks for the example, it really does help a lot. One thing I'm having a problem with now is that there is no CategoryID in the entity table because it is a relationship. Would i want to set the DataField to "it.Category.CategoryID" or something?


Thanks!


EDIT:
I set the DataField column equal to "Category.CategoryID" and it worked like a charm! Thanks so much!
0
Nahuel
Top achievements
Rank 1
answered on 05 May 2013, 05:38 PM
Can you elaborate an example of the same solution but with Form Template? i have a problem using the Bind method in a dropdown.. i use Bind("IDType.ID") but it does not work
0
Antonio Stoilkov
Telerik team
answered on 08 May 2013, 07:54 AM
Hello Nahuel,

It is hard to determine the cause of the problem from the information provided. In such cases we recommend assembling a sample project showing the unwanted behavior so we could debug it and advice you with the best possible solution. You could upload the project to a public sharing site and provide us with an URL.

Regards,
Antonio Stoilkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Christopher Haws
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Christopher Haws
Top achievements
Rank 1
Nahuel
Top achievements
Rank 1
Antonio Stoilkov
Telerik team
Share this question
or