I have a complex RadGrid with many columns and filters on all the columns. As the use can end up with a complex set of filter I want to add a 'clear all filters' button. As it is a parent/detail grid I figured I would use the space next to the filters created by the expand/collapse column. So I managed to 'successfully' put a new image button in that space with the following code which I have in my Grid ItemDataBound method..
I'm assuming I have this all wrong as I have two problems.
1) Clicking the button makes it disappear
2) Clicking the button never fires the clearbutton event.
Can anyone help and maybe this should be a feature in the RadGrid control in the future?
Thanks
Colin
// Creating filtering row clear all filters button
if ((e.Item.ItemType == GridItemType.FilteringItem))
{
var clearFilterButton = new RadButton
{
ButtonType = RadButtonType.StandardButton,
Height = 22,
Width = 22
};
clearFilterButton.Image.EnableImageButton = true;
clearFilterButton.Image.ImageUrl = string.Format("../App_Themes/{0}/Images/ClearFilter.png", Page.Theme);
clearFilterButton.ToolTip = "Clear current filter(s)";
clearFilterButton.Click += ClearButton_Click;
var expandCollapseColumn = (GridTableCell) e.Item.Controls[0];
expandCollapseColumn.Controls.Add(clearFilterButton);
}
I'm assuming I have this all wrong as I have two problems.
1) Clicking the button makes it disappear
2) Clicking the button never fires the clearbutton event.
Can anyone help and maybe this should be a feature in the RadGrid control in the future?
Thanks
Colin