Hello,
I am trying to add excel style filtering to our current application. To achieve this the solution has been upgraded with the Telerik 15.3.1111.45 upgrade.
But after adding
gridview.AllowFilteringByColumn = true;
gridview.EnableHeaderContextFilterMenu = true;
gridview.FilterType = GridFilterType.HeaderContext;
to the constructor of the grid.
I saw a little change in the layout of the header column but no filtermenu button to open. (as mentioned: http://demos.telerik.com/aspnet-ajax/grid/examples/functionality/filtering/excel-like-filtering/defaultcs.aspx )
My guess is that I'm forgetting one thing that is needed to show the menu demonstrated in above link.
To be sure I'll also post the GridHeaderTemplate that we set as columnheader (and shows everything in the columnheader) (This is basically how column headers showed the info needed before excel style filtering)
public void InstantiateIn(Control container)
{
// Check if column is sorted and show corresponding image
SortingProp sort = null;
bool hasSort = controller.CurrentSorting != null && controller.CurrentSorting.TryGetValue(prop.ID, out sort);
if (hasSort)
{
var div = new HtmlGenericControl("div");
var image = new HtmlImage { Src = "images/grid_sort_" };
div.Attributes.Add("class", "sort");
image.Src += sort.SortDirection == MySortDirection.Ascending ? "ascending.png" : "descending.png";
div.Controls.Add(image);
container.Controls.Add(div);
}
// Check if column is filtered and show corresponding image
if (controller.IsPropFiltered(prop.ObjProp.ObjProp))
{
var image = new HtmlImage { Src = MyFileUrls.CreateSharedImageUrl(ImageRepository.Shared.filter_16, false) };
image.Attributes.Add("class", "filter");
container.Controls.Add(image);
}
var title = new HtmlGenericControl("div");
var label = new Literal { Text = prop.ObjProp.TranslGrid };
title.Attributes.Add("class", "title");
title.Controls.Add(label);
container.Controls.Add(title);
}
regards,
Sebastiaan