Binding DataTable.DefaultView to RadGridView with dot in columnName

9 posts, 0 answers
  1. Ke
    Ke avatar
    11 posts
    Member since:
    Mar 2013

    Posted 13 Feb 2014 Link to this post

    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
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 14 Feb 2014 Link to this post

    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).

  3. UI for WPF is Visual Studio 2017 Ready
  4. Ke
    Ke avatar
    11 posts
    Member since:
    Mar 2013

    Posted 17 Feb 2014 in reply to Dimitrina Link to this post

    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".
  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 18 Feb 2014 Link to this post

    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
  6. Ke
    Ke avatar
    11 posts
    Member since:
    Mar 2013

    Posted 18 Feb 2014 in reply to Dimitrina Link to this post

    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
  7. Ke
    Ke avatar
    11 posts
    Member since:
    Mar 2013

    Posted 19 Feb 2014 in reply to Dimitrina Link to this post

    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;
            }
        }
    }



  8. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 20 Feb 2014 Link to this post

    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
  9. Thomas
    Thomas avatar
    4 posts
    Member since:
    Nov 2014

    Posted 10 Dec 2015 Link to this post

    Are there any solution for this?
  10. Petya
    Admin
    Petya avatar
    975 posts

    Posted 15 Dec 2015 Link to this post

    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
Back to Top
UI for WPF is Visual Studio 2017 Ready