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

RadGrid Filter on header

4 Answers 536 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 21 Dec 2012, 12:48 AM
Is there a way to remove the Filter Row and set it into the Column Header?

setting the show header to false, it hides both header and filter.

I've tried removing the filter and adding a custom one, but it doesn't work the same way, anyone has a solution?

i just don't want to have 2 rows on the header (header and filter)

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 21 Dec 2012, 07:47 AM
Hi,

One suggestion is that you can hide header and add a label to show the header text. Here is the sample code.
C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
 if (e.Item is GridHeaderItem)
 {
   GridHeaderItem header = (GridHeaderItem)e.Item;
   header.Display = false;
 }
 if (e.Item is GridFilteringItem)
 {
  foreach (GridColumn col in RadGrid1.Columns)
  {
    GridFilteringItem fitem = (GridFilteringItem)e.Item;
    Label lbl = new Label();
    lbl.Text = col.HeaderText;
    lbl.CssClass = "lblclass";
    fitem[col.UniqueName].Controls.Add(lbl);
  }
 }
}
CSS:
<style type="text/css">
    .lblclass
    {
       margin-left:-100px;
    }
    </style>

Thanks,
Shinu.
0
David
Top achievements
Rank 1
answered on 21 Dec 2012, 06:27 PM
But if I hide the header, the filter hides too, and I dont want that.

I want to keep the default filter, just hiding the Header
0
Shinu
Top achievements
Rank 2
answered on 24 Dec 2012, 06:01 AM
Hi,

I was able to replicate the issue when i set 'ShowHeader' to False. You  can hide the Header and show the filter row using the above mentioned code.

Thanks,
Shinu.

0
David
Top achievements
Rank 1
answered on 26 Dec 2012, 06:01 PM
It's solved now, I used a very similar approach to this

http://www.telerik.com/community/forums/aspnet-ajax/filter/filter-as-textbox-on-radgrid-header-with-autosuggest.aspx

Thank you very much :)

This thread may be closed.
Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
David
Top achievements
Rank 1
Share this question
or