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

Filter Indicator

2 Answers 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael O'Flaherty
Top achievements
Rank 2
Michael O'Flaherty asked on 09 Apr 2012, 06:02 PM
Hi!

Is there a way to show an icon or highlight these controls somehow when a filter is set on a paticular column? (See attached)

Thanks!

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 10 Apr 2012, 08:10 AM
Hello Michael,

Try the following code to add an icon to indicate a column is filtered.
C#:
bool check = false;
string uniquename = string.Empty;
protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
  if (e.CommandName == RadGrid.FilterCommandName)
  {
    Pair filterPair = (Pair)e.CommandArgument;
    uniquename=filterPair.Second.ToString();//accessing the column unique name
    check = true;
   }
   else
   {
     check = false;
    }
}
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
 if (check)
 {
  GridFilteringItem item = (GridFilteringItem)RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem)[0];
  Image img = new Image();
  img.ID = uniquename;
  img.ImageUrl = "~/Images/img.gif";
  item[uniquename].Controls.Add(img);
  }
}

Thanks,
Shinu.
0
Michael O'Flaherty
Top achievements
Rank 2
answered on 10 Apr 2012, 04:36 PM
Thanks! This points me in the right direction.
Tags
Grid
Asked by
Michael O'Flaherty
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Michael O'Flaherty
Top achievements
Rank 2
Share this question
or