Reputation: 1309
I have successfully created a grid with parent rows which can be expanded into a child row. I would like to have a combobox in a column in the child row which has different items depending on values in the parent row. How can I populate the comboboxes differently for each child row?
What I need is a way of getting the parent row at the same time as the combobox in the child row. I can't seem to find an event or property which can access one from the other.
Upvotes: 0
Views: 4083
Reputation: 1309
Hours later, I found this. I used the CustomRowCellEdit
on my GridView
event
myGridView.CustomRowCellEdit += new CustomRowCellEditEventHandler(myGridView_CustomRowCellEdit);
which will give you the row
void myGridView_CustomRowCellEdit(object sender, CustomRowCellEditEventArgs e)
{
myRowType myRow = (sender as GridView).GetRow(e.RowHandle) as myRowType;
and you can make a new editor like so
RepositoryItemComboBox editor = new RepositoryItemComboBox();
editor.Items.AddRange(myRow.AllowedValues);
e.RepositoryItem = editor;
Trying to modify an existing editor (combobox
or otherwise) will not work.
Upvotes: 1