Bind column to specific index of List<object>

2 posts, 0 answers
  1. Eric
    Eric avatar
    28 posts
    Member since:
    Nov 2007

    Posted 23 Aug 2015 Link to this post

    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.

  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 24 Aug 2015 Link to this post

    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 is demonstrates 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
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top