Issue filter NULL value in GridViewDataColumn

4 posts, 2 answers
  1. Abhilash
    Abhilash avatar
    3 posts
    Member since:
    May 2016

    Posted 26 May Link to this post

    Hi,
    I am using RadGridView with columns bound to string properties of objects bound to grid. If the value in object for columns is null, it displays [null] in column filter, however clicking on checkbox next to null doesn't filter any data.

    However if instead if I make column return empty string as shown below, the filter shows [empty] option and it works perfectly.

    How can I make filter work when it has [null]?

    public class SampleModel: ModelBase   
    public string Name      
    {          
    get           
    {               
         return _name == null ? string.Empty : _name;           
    }           
    set          
     {               
     _name = value;               
     DoPropertyChanged(() => Name);          
     }      
     }
    }

  2. Answer
    Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    371 posts

    Posted 30 May Link to this post

    Hello Abhilash,

    I'm attaching a sample project where the filtering of null values is working as expected at my end.

    Could you please have a look at it and let me know if I'm missing something?

    Regards,
    Dilyan Traykov
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. DevCraft banner
  4. Abhilash
    Abhilash avatar
    3 posts
    Member since:
    May 2016

    Posted 31 May in reply to Dilyan Traykov Link to this post

    Thanks Dilyan. I realized its throwing exception on storing the column filters to isolated storage, hence null filter doesn't work.
    We have requirement to store user filter selection in isolate storage.

    Below is the stack trace:

       at Telerik.Windows.Persistence.Serialization.Serializer.SaveCollectionValue(IEnumerable collection, String propertyName, Type propertyType, String propertyPath, ReferenceValue parentValue, SerializationMetadataCollection options, Boolean shouldValidateCriteria, Int32 nestingDepth, MatchResult propDataMatchResult)
       at Telerik.Windows.Persistence.Serialization.Serializer.SaveProperty(PropertyInfo property, String path, Object obj, ReferenceValue parentValue, SerializationMetadataCollection options, Boolean shouldValidateCriteria, Int32 nestingDepth, PropertyData parentPropData, MatchResult parentMatchResult)
       at Telerik.Windows.Persistence.Serialization.UISerializer.SaveProperty(PropertyInfo property, String path, Object obj, ReferenceValue parentValue, SerializationMetadataCollection options, Boolean shouldValidateCriteria, Int32 nestingDepth, PropertyData parentPropData, MatchResult parentMatchResult)
       at Telerik.Windows.Persistence.Serialization.Serializer.GeneratePropertyTree(Object objectToSerialize, String path, ReferenceValue parentValue, PropertyData parentPropData, SerializationMetadataCollection options, Boolean shouldValidateCriteria, Int32 nestingDepth)
       at Telerik.Windows.Persistence.Serialization.Serializer.SaveCollectionValue(IEnumerable collection, String propertyName, Type propertyType, String propertyPath, ReferenceValue parentValue, SerializationMetadataCollection options, Boolean shouldValidateCriteria, Int32 nestingDepth, MatchResult propDataMatchResult)
       at Telerik.Windows.Persistence.Serialization.Serializer.HandleCustomPropertyProvider(Object objectToSerialize, Type type, String path, ReferenceValue parentValue, PropertyData parentPropData, SerializationMetadataCollection options, Boolean shouldValidateCriteria, Int32 nestingDepth)
       at Telerik.Windows.Persistence.Serialization.Serializer.GeneratePropertyTree(Object objectToSerialize, String path, ReferenceValue parentValue, PropertyData parentPropData, SerializationMetadataCollection options, Boolean shouldValidateCriteria, Int32 nestingDepth)
       at Telerik.Windows.Persistence.Serialization.Serializer.GenerateRootElementTree(Object objectToSerialize)
       at Telerik.Windows.Persistence.Serialization.Serializer.Serialize(Object obj)
       at Telerik.Windows.Persistence.PersistenceManager.Save(Object obj)
       at Telerik.Windows.Persistence.Storage.IsolatedStorageProvider.SaveToStorage()
       at CRM.CRMLite.Common.Behaviors.RadGridPersistanceBehaviour.Save()

     

    Your help on this would be appreciated.

     

    Regards,
    Abhilash

  5. Answer
    Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    371 posts

    Posted 01 Jun Link to this post

    Hello Abhilash,

    I'm afraid that without a sample project demonstrating the exception, I'm unable to assist you further. Could you please provide more information about your setup and if possible, share some code snippets of the area where the exception is thrown? You could also modify the project I sent you to reproduce the behavior and send over code snippets with the modifications made so that I can observe it at my end as well.

    Additionally, you can have a look at the RadPersistenceFramework documentation article regarding Isolated Storage as well as the GridView Serialization demos in our SDK Samples Browser and Silverlight Controls Demo Site for information on how to store user filter selection in isolate storage, if you have not done so already.

    Regards,
    Dilyan Traykov
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top