Radgrid filter position

2 posts, 0 answers
  1. james
    james avatar
    24 posts
    Member since:
    Aug 2014

    Posted 24 Jul 2015 Link to this post

    Hi,

     

    Is there a way to position the datepickers vertically on a date range filter column? Because of the number of columns, users are forced resize the datetime column to access the second datepicker in a range fileter.

     

     

    James

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 27 Jul 2015 Link to this post

    Hi James,

    For placing the second RadDatePicker on a new line when range filtering is enabled you can handle the server-side OnPreRender event of the grid and use the following code:
    protected void RadGrid1_PreRender(object sender, EventArgs e)
    {
        GridFilteringItem filteringItem = RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem)[0] as GridFilteringItem;
        foreach (GridColumn column in RadGrid1.MasterTableView.RenderColumns)
        {
            if (column is GridDateTimeColumn && (column as GridDateTimeColumn).EnableRangeFiltering)
            {
                LiteralControl literal = filteringItem[column.UniqueName].Controls[0] as LiteralControl;
                literal.Text = "<span style='display:inline-block; width: 40px;'>" + literal.Text + "</span>";
     
                literal = filteringItem[column.UniqueName].Controls[3] as LiteralControl;
                literal.Text = "<br /><span style='display:inline-block; width: 40px;'>" + literal.Text + "</span>";
            }
        }
    }

    Hope this helps.


    Regards,
    Konstantin Dikov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top