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

Filter Headings - 3 part Question

4 Answers 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 1
Shawn asked on 17 Jun 2009, 05:54 PM
I have figured out how to hide the filter textbox for a column by doing the following:

If TypeOf e.Item Is GridFilteringItem Then 
 
            Dim filteringItem As GridFilteringItem = CType(e.Item, GridFilteringItem) 
            'set dimensions for the filter textbox 
            Dim box As TextBox = CType(filteringItem("CheckBoxTemplateColumn").Controls(0), TextBox) 
            box.Visible = False 

But...

1. how do I hide the filter icon that is next to each text box?

2. how can I add my own custom text in place of it if I want to?

3. how can I hide the filter options I do not want? for instance on a numeric column named "points" I only want "GreaterThan" and GreaterThanEqualTo".

Thanks!

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 18 Jun 2009, 05:20 AM
Hello Shawn,

You can try out the following code to hide the filtericon and display a text instead for a column:
vb:
Protected Sub RadGrid1_ItemDataBound(sender As Object, e As GridItemEventArgs) 
    If TypeOf e.Item Is GridFilteringItem Then 
        Dim filter As GridFilteringItem = DirectCast(e.Item, GridFilteringItem) 
        (DirectCast(filter("Name").Controls(1), Button)).Visible = False 
        Dim lbl As New Label() 
        lbl.ID = "Label1" 
        lbl.Text = "filter" 
        filter("Name").Controls.AddAt(1, lbl) 
    End If 
End Sub 

Also refer to the following help document which explains on how to minimize the filter options:
Reducing the filter menu options

Thanks
Princy.
0
Ramesh
Top achievements
Rank 1
answered on 18 Jun 2009, 07:20 AM
hi,

I want to know how to hide the filter textbox on the grid when the grid in the edit mode.

Regards,
Premnath.T
0
Shinu
Top achievements
Rank 1
answered on 18 Jun 2009, 07:55 AM
Hi Premnath,

Check out the following code to hide the filter textbox for a column in the grid, when the grid in the edit mode:
c#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
        { 
            GridFilteringItem filter = (GridFilteringItem)RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem)[0]; 
            ((TextBox)filter["ColumnUniqueName"].Controls[0]).Visible = false
           
        }  
    } 

Thanks
Shinu.
0
Ramesh
Top achievements
Rank 1
answered on 24 Jun 2009, 04:48 AM
Hi,

Thanks for your quick reply its working fine.

Regards,
Premnath.T
Tags
Grid
Asked by
Shawn
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Ramesh
Top achievements
Rank 1
Shinu
Top achievements
Rank 1
Share this question
or