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

[Solved] Cast bound data at some point?

1 Answer 48 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Luke
Top achievements
Rank 1
Luke asked on 22 Apr 2013, 03:43 AM
Hello

I have a gridview which is bound to a dynamic object. The dynamic object contains a dictionary of <string,string>. However, as the dynamic object tryGetMember method returns object, it seems the gridviews data is of type object. These is giving me a problem when using filter such as contains.

Is there a way to either cast the data in the grid to string after it has retrieved it, or have the dynamic object return string instead of object to it?

Thank you for your time

Luke

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 22 Apr 2013, 08:15 AM
Hi,

The only way to enable filtering and sorting on a dynamic property (which is always of type Object) would be to "help"  the column by giving it a hint about the actual data type of the underlying objects. This is done by setting the DataType property of the respective GridViewDataColumn.

Alternatively, you can replace the dynamic objects with an implementation of ICustomTypeProvider which carry the type information.

Greetings,
Rossen Hristov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Luke
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or