This project is read-only.
1
Vote

Master Grid with Detail Grid (both untyped datatable as source) - filtering error

description

Context: I have a Master Grid and each row has its detail with a tabstrip and tabs with others grid (untyped datatable as source).
When i try to filter a column of type string, i got a exception.
 
I come along and try to fix the code and realize that the parameter 'memberType' in ExpressionBuilderFactory.MemberAccessExpressionBuilderBase is getting object and not string.
 
So for me the following code fix the issue.
I hope telerik add a fix to that in the following versions of this wonderfull product.
 
            //Bug fix
            //DataRow (from a dynamic datatable)
            if (memberType is object)
            {
                memberType = typeof(string);
            }

comments

jvitor83 wrote Sep 27, 2011 at 10:56 PM

The exception is exactly this one:
http://www.telerik.com/community/forums/aspnet-mvc/grid/filterable-error-when-using-gridcolumnsettings.aspx

The entire code of the fix is this one:
public static MemberAccessExpressionBuilderBase MemberAccess(Type elementType, Type memberType, string memberName)
    {
        memberType = memberType ?? typeof(object);

        if (elementType.IsCompatibleWith(typeof(DataRow)))
        {
            //Bug fix
            //DataRow dinâmico
            if (memberType is object)
            {
                memberType = typeof(string);
            }


            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 MVC3

        if (elementType == typeof(object) || elementType.IsCompatibleWith(typeof(System.Dynamic.IDynamicMetaObjectProvider)))
        {
            return new DynamicPropertyAccessExpressionBuilder(elementType, memberName);
        }

endif

        return new PropertyAccessExpressionBuilder(elementType, memberName);
    }

wrote Feb 21, 2013 at 11:58 PM