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

Bind column to specific index of List<object>

1 Answer 221 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 24 Aug 2015, 12:33 AM

Can you bind a column to a specific index in a List, without using a hierarchical grid?

For example, with the following data structure:

public class Survey {
    public string Name { get; set; }
    public List<string> Answers { get; set; }
    public Survey() {
        Answers = new List<string>();
    }
}
 

The grid is bound to a data source of List<Survey>.  

I can obviously create a column with a FieldName of: "Name".

Can I create a column with a FieldName of: "Answers[0]"?

 

I looked at the documentation article Binding to Sub Objects, and I didn't notice any restrictions on this.

 

Thanks,

Eric.

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 24 Aug 2015, 12:12 PM
Hello Eric,

Thank you for writing.

You cannot bind a column to a certain record, but perhaps you can have a combo box column, and set the data source for each cell when it gets into edit mode. This approach here: http://www.telerik.com/support/kb/winforms/gridview/details/cascading-comboboxes-in-radgridview

I hope that this will work for you.

Regards,
Stefan
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Eric
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or