V
V
Vadim2016-01-26 21:44:52
MySQL
Vadim, 2016-01-26 21:44:52

Which component to choose to work with EF model classes?

Hello!
Now I am developing a simple application that should work with the database. The main functionality (CRUD operations) is already ready. Now I want to find a convenient way to output data from the database to the program interface. Tried to use DataGrid and on an example of one table selected DbSet<> of the corresponding class as a source. The advantage of this component is that it allows you to easily change data, add and delete them. But the question is this: for example, there is a one-to-many relationship between two tables T1 and T2 with the corresponding foreign key T2_id, and when adding a new row to the table, you have to manually enter T2_id. So, I would like to know if it is possible somehow to "shove" a ComboBox in the T2_id cells, in which one could choose one option from those available in the T2 table.
Thoughts are now confused and I explained as best I could at the moment) If some points are not clear, I will later try to describe the situation with pictures, as I see it.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Aleksej, 2016-01-27
@Koolerz

Basically DataGrid can have any other controls in cells, including ComboBox.
You only need to bind not the entire DataSet, but manually specify which columns to take from it (AutoGenerateColumns="False") and take DataGridComboBoxColumn or DataGridTemplateColumn for the ID column.

C
Curly Brace, 2016-01-26
@stasuss

telerik has no such components. devexpress is not recommended.
I do not advertise this, but everything is quite easy to set up there)

R
Roman, 2016-01-27
@yarosroman

Do you have dependencies in your model?
those in T1 must have a property public ICollection T2{get; set;}
and in T2 should be public T1 T1 {get; set;}
the main thing is to set up the bindings and get the data context.T1Set.Include("T2")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question