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

[Solved] Foreign key column in the grid

1 Answer 145 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dani
Top achievements
Rank 1
Dani asked on 28 May 2012, 08:52 AM
I have an editable grid with a foreign key column. Each one of my rows has a distinct value of the foreign key. Row1 and row2 can't have the same foreign key. That's why what I want is this: when I delete row1, the foreignKeyOfRow1 to be removed from the combobox for the foreign key column. I'm trying to do that by this:

    var dropdown = $("#MyForeignKeyColumn").data('tDropDownList');
    var dataSource = ['1', '2', '3'];//some examples
    dropdown.dataBind(dataSource);

But I can't select something from the combobox after that - the combobox doesn't notice the selected item. I get error "The MyForeignKeyColumn field is required. " because the comboBox is empty.

In the controller, in the method for deleting the item in the row, I'm returning Json with the new values I want the grid to be populated with (with no foreignKeyOfRow1 and no row1, and row1 is gone, but foreignKeyOfRow1 remains).

1 Answer, 1 is accepted

Sort by
0
Dani
Top achievements
Rank 1
answered on 29 May 2012, 01:05 PM
Someone??
Tags
Grid
Asked by
Dani
Top achievements
Rank 1
Answers by
Dani
Top achievements
Rank 1
Share this question
or