Custom columns on GridView crash when click on filter icon

1 posts, 0 answers
  1. Andreas
    Andreas avatar
    12 posts
    Member since:
    Jun 2012

    Posted 23 Feb 2012 Link to this post


    I have a GridView that includes static and dynamic columns. When I try to use the filtering on the dynamic columns I get a pop-up unhanded exception message (attached file). All dynamic rows have data inside of type string. This is a sample code 

                         Dim index = 0
                            For Each oCustomIndex As CustomIndex In oDocument.CustomIndexes
                                If (oRadGridDocumentSearchResults.Columns(oCustomIndex.Name) Is NothingThen
                                    Dim oGridViewColumn As New GridViewDataColumn()
                                    oGridViewColumn.Header = oCustomIndex.Name.Replace("_"" ")
                                    oGridViewColumn.UniqueName = oCustomIndex.Name
                                    oGridViewColumn.IsFilterable = True
                                    oGridViewColumn.IsGroupable = True
                                    oGridViewColumn.IsReadOnly = True
                                    oGridViewColumn.IsSortable = True
                                    oGridViewColumn.DataType = GetType(String)
                                    oGridViewColumn.DataMemberBinding = New Binding(".")
                                    oGridViewColumn.DataMemberBinding.Mode = BindingMode.OneWay
                                    oGridViewColumn.DataMemberBinding.Converter = New CustomIndexesToStringConverter()
                                    oGridViewColumn.DataMemberBinding.ConverterParameter = index
                                    index += 1
                                End If

    Public Class CustomIndexesToStringConverter
        Implements IValueConverter
        Public Function Convert(ByVal value As ObjectByVal targetType As System.TypeByVal parameter As ObjectByVal culture As System.Globalization.CultureInfoAs Object Implements System.Windows.Data.IValueConverter.Convert
                Dim oMVDocument As MVDocument = value
                Dim oString As String = oMVDocument.CustomIndexes(parameter).Value
                Return oString
            Catch ex As Exception
                ReportError(ex.Message, GetCurrentMethod.Name)
            End Try
            Return Nothing
        End Function
        Public Function ConvertBack(ByVal value As ObjectByVal targetType As System.TypeByVal parameter As ObjectByVal culture As System.Globalization.CultureInfoAs Object Implements System.Windows.Data.IValueConverter.ConvertBack
            Return Nothing     End Function End Class


Back to Top