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

Dynamic Filter problem

1 Answer 139 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Clinton Smyth
Top achievements
Rank 1
Clinton Smyth asked on 19 Mar 2009, 04:01 PM
Hi

We're in the process of migrating our controls to ASP.NET AJAX and are experiencing problems with the filter box.  It works fine with the old ASP.NET controls but not with the new ones. 

The user is able to toggle the visibility of the filter boxes from the CommandItemTemplate.  Once visible, when the user types a value into the filter box and clicks the adjacent filter icon, all the filter options appear at the top of the page as an unformatted bulleted list.  They appear to be hyperlinks but do not respond to mouse clicks.

Interestingly, if I set the filter boxes as viewable on page load, the options appear in the correct place and work (although each option is surrounded by a box which varies in length according to the length of the option and hence, doesn't look as good at the old version)

The code version we're using is RadControls_for_ASP.NET_AJAX_2008_3_1314_dev_hotfix.zip

The code behind that controls the visibility of the filter boxes is:
    Private Sub RadGridWorksheet_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGridWorksheet.ItemCreated  
        If e.Item.ItemType = GridItemType.CommandItem Then  
            Dim commandItem As GridCommandItem = CType(e.Item, GridCommandItem)  
            Dim showFilterLinkButton As LinkButton = commandItem.FindControl("ShowFilterBoxesLinkButton")  
            Dim hideFilterLinkButton As LinkButton = commandItem.FindControl("HideFilterBoxesLinkButton")  
 
            'Adding the event handler  
            AddHandler showFilterLinkButton.Click, AddressOf chkFilter_CheckedChanged  
            AddHandler hideFilterLinkButton.Click, AddressOf chkFilter_CheckedChanged  
        End If  
    End Sub  
 
 
    Protected Sub chkFilter_CheckedChanged(ByVal Sender As Object, ByVal e As System.EventArgs)  
        ' Toggle the filter boxes  
        RadGridWorksheet.AllowFilteringByColumn = Not RadGridWorksheet.AllowFilteringByColumn  
        RadGridWorksheet.Rebind()  
    End Sub  
 
 

It appears that the CSS is not being applied to the option list correctly in this case.

Please help.

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 23 Mar 2009, 03:09 PM
Hi,

In order to workaround the behavior in question you should set RadGrid's filtering menu EnableAjaxSkinRendering to true on page's load event. Similar to the following:

    Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
        RadGrid1.FilterMenu.EnableAjaxSkinRendering = True 
    End Sub 

Please note also that instead using AllowFilteringByColumn  to toggle the filtering item visibility, you can set AllowFilteringByColumn  to true and use GridFilterItem's Expand property instead.

Rosen
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Clinton Smyth
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or