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

Binding DataTable.DefaultView to RadGridView with dot in columnName

8 Answers 142 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ke
Top achievements
Rank 1
Ke asked on 13 Feb 2014, 07:42 PM
Hi There,
I am binding DataTable.DefaultView to RadGridView and I have column in the datatable named "a.b", which appears blank in RadGridView. Also grouping by it will generate an exception saying "property a doesn't exist in DataRowView". Is there a way to tweak the binding so column "a.b" would work?

Thanks,
Ke

8 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 14 Feb 2014, 04:10 PM
Hello Ke,

Binding to properties like "a.b" should work find and the values should be resolved from the binding. If it is different at your side, may I ask you to test the same with the MS DataGrid?

As to grouping on such a property - this is not supported as a property name starting with a dot is not a valid name in .Net Framework.

Regards,
Didie
Telerik

Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).

0
Ke
Top achievements
Rank 1
answered on 17 Feb 2014, 07:48 PM
Hi There,
We are not bound the column to a property "a.b", but there is a column named "a.b" in the datatable. It works fine binding to the datatable directly(both grouping and data display works), but when we bind RadGridView with dataTable.DefaultView, it stops working complaining about "property a doesn't exist in DataRowView".
0
Dimitrina
Telerik team
answered on 18 Feb 2014, 11:30 AM
Hello,

I can still not observe the issue at my end. Please find attached a test solution I created in my attempt to reproduce the problem.

Would you please modify it to illustrate your setup?

Regards,
Didie
Telerik
0
Ke
Top achievements
Rank 1
answered on 18 Feb 2014, 03:40 PM
Hi Didie,
Attached is the screenshot of running your example. We are using version 2013.3.1016.40. Is it fixed in later versions?

Thanks,
Ke
0
Ke
Top achievements
Rank 1
answered on 19 Feb 2014, 05:53 PM
Hi Didie,
So for grouping we did some digging and found the code below in your dlls,  so if you could just add DataRowView like you did with DataRow, then grouping/aggregates by columns with dots in their names(a.b) will work. Can you help check if this can be fixed in your next release? Thanks!

namespace Telerik.Windows.Data.Expressions
{
    internal static class ExpressionBuilderFactory
    {
        public static MemberAccessExpressionBuilderBase MemberAccess(Type elementType, Type memberType, string memberName)
        {
            memberType = memberType ?? typeof(object);
            if (elementType.IsCompatibleWith(typeof(DataRow)))
            {
                return new DataRowFieldAccessExpressionBuilder(memberType, memberName);
            }
            if (elementType.IsCompatibleWith(typeof(ICustomTypeDescriptor)))
            {
                return new CustomTypeDescriptorPropertyAccessExpressionBuilder(elementType, memberType, memberName);
            }
            if (elementType.IsCompatibleWith(typeof(XmlNode
)))
            {
                return new XmlNodeChildElementAccessExpressionBuilder(memberName);
            }
            if (elementType.IsDynamic())
            {
                return new DynamicPropertyAccessExpressionBuilder(elementType, memberName, memberType);
            }
            return new PropertyAccessExpressionBuilder(elementType, memberName, memberType);
        }

        public static MemberAccessExpressionBuilderBase MemberAccess(IQueryable source, Type memberType, string memberName)
        {
            MemberAccessExpressionBuilderBase objectsProvider = ExpressionBuilderFactory.MemberAccess(source.ElementType, memberType, memberName);
            objectsProvider.Options.LiftMemberAccessToNull = source.Provider.IsLinqToObjectsProvider();
            return objectsProvider;
        }
    }
}



0
Dimitrina
Telerik team
answered on 20 Feb 2014, 12:56 PM
Hi Ke,

You are right. Such a Binding is not supported with the latest version.
I apologize for misleading you. I am afraid currently I cannot suggest you a workaround.

I have forwarded your feedback to the development team.

Regards,
Didie
Telerik
0
Thomas
Top achievements
Rank 1
answered on 10 Dec 2015, 03:22 PM
Are there any solution for this?
0
Petya
Telerik team
answered on 15 Dec 2015, 02:04 PM
Hello Thomas,

The issue hasn't been fixed at this point, but we'll try to resolve it for one of our upcoming releases. I created a public item where you can track the team's progress, you can subscribe to it here.

Regards,
Petya
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
Ke
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Ke
Top achievements
Rank 1
Thomas
Top achievements
Rank 1
Petya
Telerik team
Share this question
or