Filter Indicator

3 posts, 1 answers
  1. Michael O'Flaherty
    Michael O'Flaherty avatar
    67 posts
    Member since:
    Jun 2010

    Posted 09 Apr 2012 Link to this post

    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. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 10 Apr 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Michael O'Flaherty
    Michael O'Flaherty avatar
    67 posts
    Member since:
    Jun 2010

    Posted 10 Apr 2012 Link to this post

    Thanks! This points me in the right direction.
Back to Top