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

Issue filter NULL value in GridViewDataColumn

3 Answers 456 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Abhilash
Top achievements
Rank 1
Abhilash asked on 26 May 2016, 04:16 PM

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

3 Answers, 1 is accepted

Sort by
0
Accepted
Dilyan Traykov
Telerik team
answered on 30 May 2016, 08:50 AM
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.
0
Abhilash
Top achievements
Rank 1
answered on 31 May 2016, 12:49 PM

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

0
Accepted
Dilyan Traykov
Telerik team
answered on 01 Jun 2016, 02:42 PM
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 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.
Tags
GridView
Asked by
Abhilash
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Abhilash
Top achievements
Rank 1
Share this question
or