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.
Can anyone help me how to make the sorting and filtering work?
Thanks,
Leo
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