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

How to sort and filter on gridColumn that binds to SubObject

1 Answer 24 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Leo
Top achievements
Rank 1
Leo asked on 22 Mar 2011, 08:23 AM
Hi,

The main itemsSource is bound to list of Product, but the product class has another object field(this field is object) that stands for custom properties. Now, I wan to dynamically adding the custom properties to the gridview. The method is showing bellow, but the sorting and filtering is not working. I don't know if telerik supports this feature.

private void DynamicallyCreateColumns(Type type)
        {
            var propertyList = TypeHelper.GetPropertyInfosInOrder(type);
            foreach (var propertyInfo in propertyList)
            {
                var column = new GridViewDataColumn();
                var displayAttribute = TypeHelper.GetDisplayAttribute(propertyInfo);
                column.Header = displayAttribute.Name;
                string propertyPath = string.Format(CustomPropertyPathFormat, propertyInfo.Name);
                column.UniqueName = propertyPath;
                Binding binding = new Binding();
                binding.Path = new PropertyPath(propertyPath);
                column.DataMemberBinding = binding;
                column.DataType = propertyInfo.PropertyType;
                this.MainGrid.Columns.Add(column);
            }
        }


Can anyone help me how to make the sorting and filtering work?

Thanks,
Leo

1 Answer, 1 is accepted

Sort by
0
Leo
Top achievements
Rank 1
answered on 22 Mar 2011, 08:41 AM
It just doesn't work...
Tags
GridView
Asked by
Leo
Top achievements
Rank 1
Answers by
Leo
Top achievements
Rank 1
Share this question
or