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

problem with filter

6 Answers 140 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Christian
Top achievements
Rank 1
Christian asked on 09 Mar 2009, 12:18 PM
I'm trying to get a filter into my grid, but it doesn't work.

We create the Grid with vb.net and put it then into the paceholder:


g = instance of Grid

 

With g   
 .AllowFilteringByColumn = True     
 
...  
...  
 
End With 
 
boundColumn = New GridBoundColumn   
boundColumn.DataField = "Field"   
boundColumn.HeaderText = fieldNames(4).ToString  
boundColumn.ShowSortIcon = True   
boundColumn.Groupable = True   
boundColumn.AllowFiltering = True   
g.MasterTableView.Columns.Add(boundColumn)  
 

 

 

 We doesn't I see the filter. where is the error?

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 10 Mar 2009, 05:47 AM
Hi Christian,

Are you creating the entire grid in the Page_Init event? Filtering must work with dynamically created Grid since you have set AllowFilteringByColumn to true. Here is a help article which explains how to create the entire Grid dynamically. Refer that and see if anything is missing.
Programmatic creation

Shinu



0
Christian
Top achievements
Rank 1
answered on 10 Mar 2009, 07:53 AM
Yes, I create the entire grid in the Page_Init event.

Thanks for your link I will read it.
0
Christian
Top achievements
Rank 1
answered on 10 Mar 2009, 08:03 AM
So far as I see have I buid the Radgrid in the same way in the Page_Init event handler, except that I bind the Datasource ti the grid in the Page_Init event handler too.
 
When I put the binding to the datasource the filtering doesn't appear also.
0
Christian
Top achievements
Rank 1
answered on 10 Mar 2009, 08:25 AM
For better understanding here the code which creates the RadGrid:
        With g  
            .AutoSave = False 
            .ID = "RG" & CStr(Index).Trim  
            .SkinID = "List" 
            .DataSource = dt_Overview '->DataTable  
            .MasterTableView.SortExpressions.AllowNaturalSort = False 
            .AllowSorting = True 
            .AllowFilteringByColumn = True 
            .Width = Unit.Percentage(100)  
            .AutoGenerateColumns = False 
            .ShowGroupPanel = False 
            .ShowFooter = False 
            .AllowPaging = False 
            .PageSize = 100000 '17  
            .HeaderStyle.Width = Unit.Pixel(1)  
            .GroupingEnabled = True 
        End With 
        With g.ClientSettings  
            .AllowDragToGroup = True 
            .AllowExpandCollapse = True 
            .AllowGroupExpandCollapse = True 
            .Scrolling.ScrollHeight = Unit.Pixel(412)  
            .Scrolling.SaveScrollPosition = True 
            .ClientEvents.OnGridCreated = "GridCreated" & CStr(Index).Trim  
            .ClientEvents.OnMasterTableViewCreated = "hide_MasterApp_Updateprogress" 
            .ClientEvents.OnScroll = "Scroll" & CStr(Index).Trim  
        End With 
        With g.HeaderStyle  
            .Width = Unit.Pixel(170)  
        End With 
        With g.MasterTableView  
            .CssClass = "MasterTable" 
            .DataKeyNames = New String() {"DPU_ZEILENNR"}  
            .CommandItemDisplay = GridCommandItemDisplay.None  
            .GroupLoadMode = GridGroupLoadMode.Server  
        End With 
        With g.MasterTableView.RowIndicatorColumn  
            .UniqueName = "RowIndicator" 
            .Visible = False 
            .HeaderStyle.Width = Unit.Pixel(20)  
        End With 
 

 

and an example for one Column:

 

            boundColumn = New GridBoundColumn  
            boundColumn.DataField = "IMP_WERT" 
            boundColumn.UniqueName = "IMP_ID" 
            boundColumn.HeaderText = "Header" 
            boundColumn.HeaderText = fieldNames(4).ToString  
            boundColumn.ShowSortIcon = True 
            boundColumn.AllowFiltering = True 
            boundColumn.CurrentFilterFunction = GridKnownFunction.EqualTo  
            boundColumn.Visible = True 
            g.MasterTableView.Columns.Add(boundColumn) 
0
Christian
Top achievements
Rank 1
answered on 10 Mar 2009, 04:34 PM
Has someone an idea?

Christian
0
Christian
Top achievements
Rank 1
answered on 11 Mar 2009, 02:54 PM
We have fixed the problem.

There was a bug in the ItemCreated-event-procedure.

Christian
Tags
Grid
Asked by
Christian
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Christian
Top achievements
Rank 1
Share this question
or