We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback


Thread ID:





4482 May 15,2003 03:53 AM UTC May 15,2003 08:02 PM UTC WinForms 5
Tags: GridControl
Jeremy Holt
Asked On May 15, 2003 03:53 AM UTC

Hi, I have a databoundgrid with a column set to combobox - the datasource of the dropdown column is a dataview, the ValueMember is an integer, and the DisplayMember is a string. When the filter bar is set, it lists in the drop down the ValueMembers - is there anyway to have it list the DisplayMember instead? If the grid is using ComboBoxes to provide lookup values, its not very useful having a list of the underlying user-unfriendly data in the filter bar. Thanks Jeremy

Administrator [Syncfusion]
Replied On May 15, 2003 11:51 AM UTC

This is on our list of things to add. Currently, you would have to derive GridFilterBar to implement this functionality. It would take some coding to get things fully implemented through a derived class. It is too late to get this into the upcoming 1.6 release, but we will try to have it for the first point release after that.

Jeremy Holt
Replied On May 15, 2003 12:29 PM UTC

I'm already deriving from the Filterbar class. However, I can't determine at what point the drop down is filled - which event should I be looking at? Thanks Jeremy

Administrator [Syncfusion]
Replied On May 15, 2003 03:15 PM UTC

Its done in WireGrid. There are several technical points that need to be handled to do things in general. Attached is a incomplete project I started this morning to try to gauge how difficult this would be in a derived class. It seems to work as long as you are just filtering the single column, but fails when you try to add filters from other columns.

Jeremy Holt
Replied On May 15, 2003 03:38 PM UTC

Clay Thanks very much - works like a dream Regards Jeremy

Jeremy Holt
Replied On May 15, 2003 08:02 PM UTC

I changed CreateEntries to the following. It now works with filters in multiple columns Protected Overrides Function GetFilterFromRow(ByVal grid As Syncfusion.Windows.Forms.Grid.GridDataBoundGrid) As String Dim filter As String = MyBase.GetFilterFromRow(grid) Dim rowIndex As Integer = Me.GetFilterRow Dim gbcc As GridBoundColumnsCollection = CType(IIf(grid.GridBoundColumns.Count = 0, grid.Binder.InternalColumns, grid.GridBoundColumns), GridBoundColumnsCollection) Dim a As String() = filter.Split("["c) For Each gbc As GridBoundColumn In gbcc Dim fieldName As String = "[" & gbc.MappingName & "]" If filter.IndexOf(fieldName) > -1 Then If gbc.StyleInfo.CellType = "ComboBox" AndAlso Not gbc.StyleInfo.DataSource Is Nothing AndAlso gbc.StyleInfo.ValueMember <> gbc.StyleInfo.DisplayMember Then Dim colIndex As Integer = grid.Binder.NameToColIndex(gbc.MappingName) Dim row As DataRow = CType(grid(rowIndex, colIndex).CellModel.BindingContext(grid(rowIndex, colIndex).DataSource).Current, DataRowView).Row Dim s As String = row.Item(gbc.StyleInfo.ValueMember).ToString Dim s1 As String = row.Item(gbc.StyleInfo.DisplayMember).ToString For i As Integer = 0 To a.Length - 1 If a(i).IndexOf(gbc.MappingName) > -1 Then a(i) = a(i).Replace(s1, s) End If Next End If End If Next filter = String.Join("[", a) Return filter End Function Jeremy


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon