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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

FilterBar + DataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

8678 Nov 15,2003 05:22 PM UTC Jan 22,2020 06:25 PM UTC WinForms 3
loading
Tags: GridControl
Jim Frapper
Asked On November 15, 2003 05:22 PM UTC

It seems, when setting the databound grid property to a dataview the filterbar is lost. For example.... DataView dv = new DataView(ds.Tables["AppointmentByStatusAndGeoID"]); dv.RowFilter = "AppointmentDate > #" + System.DateTime.Today.Date + "# AND " + "AppointmentDate < #" + System.DateTime.Today.Date.AddDays(1) + "#"; this.grdAppointments2.DataSource = dv; //create the filter bar and display it GridFilterBar theFilterBar = new GridFilterBar(); //catch the creating column header event so we can turn off unwanted filter headers //needs to be hooked before WireGrid call to catch things... theFilterBar.CreatingColumnHeader += new GridFilterBarCreatingColumnHeaderEventHandler(GridFilterBarCreatingColumnHeader); //create a style for the filter cells that uses TextBox GridStyleInfo style = new GridStyleInfo(); style.ModifyStyle(this.grdAppointments2.BaseStylesMap["Header"].StyleInfo, StyleModifyType.Copy); style.CellType = "ComboBox"; style.ExclusiveChoiceList = true; style.BaseStyle = "Standard"; style.Font.Bold = false; style.BackColor = this.grdAppointments2.TableStyle.BackColor; style.Borders.Bottom = new GridBorder(GridBorderStyle.Dashed); style.DropDownStyle = GridDropDownStyle.AutoComplete; theFilterBar.WireGrid(this.grdAppointments2, style); The filter bar is not there. If I set the datasource to a datatable then the filterbar shows up. Cheers, JF

Administrator [Syncfusion]
Replied On November 15, 2003 07:42 PM UTC

This is a known limitation. Currently, you can only use either a dataset/datatable or a datatable by itself as the grid's datasource/datamember if you want to use filterbars. You can derive the GridFilterBar class to extend it to support using a DataView as the datasource for the grid. We will add support for using a DataView as the datasource in a future release. Here is some code:
    Public Class SyncGridFilterBar
        Inherits GridFilterBar
        Private _grid As GridDataBoundGrid
        Protected Overrides Function GetDataTable() As DataTable
            If _grid.DataSource Is Nothing Then
                Return Nothing
            End If
            If _grid.DataSource.GetType Is GetType(DataTable) Then
                Return CType(_grid.DataSource, DataTable)
            ElseIf _grid.DataSource.GetType Is GetType(DataView) Then
                Return CType(_grid.DataSource, DataView).Table
            End If
        End Function

        Public Overloads Overrides Sub WireGrid(ByVal grid As GridDataBoundGrid, ByVal style As GridStyleInfo)
            _grid = grid
            MyBase.WireGrid(grid, style)
        End Sub
    End Class

Revathi Dhamotharan
Replied On January 22, 2020 02:37 AM UTC

Hi,

Is it possible to add a filter bar for a griddataboundgrid if the datasource is set to a dataview and datamember is a datarelation. When i try to wire up the filter bar, it gives me an error saying, it cannot find a column but it is there. The exception is thrown at parsesortstring in wiregrid method. Can you please tell me if this ispossible or is there a workaround?

Thank you,
Revathi

Arulpriya Ramalingam [Syncfusion]
Replied On January 22, 2020 06:25 PM UTC

 
Greetings from Syncfusion support. 
 
We have validated the reported use case at our end and as per our DataBondGrid current behavior, it does not have support to add relational dataview as DataSource whereas, it have support to add RelatedDataTable (UI will update with the main table only). So, we would suggest you to use the DataTable as binding source for the grid. If you are trying to add nested tables in the Grid UI(Parent and child table hierarchy), we would recommend you to use the SfDataGrid which has advanced features like Filtering, Sorting, Exporting and etc. please make use of below UG to know more about the SfDataGrid. 
 
 
Regards, 
Arulpriya 


CONFIRMATION

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