read filter expressions entered by user

4 posts, 0 answers
  1. ravindar
    ravindar avatar
    4 posts
    Member since:
    Apr 2014

    Posted 24 Apr 2014 Link to this post

    Hello friends,
    i have RadFilterControl for date range. i mean we have to enter from date and to date for filtering data.
    my requirement is , i have to get the to date entered by user and have to add 5 hours to it. 
    i am planning to do this in Itemcommand event before calling FireApplyCommand(). 
    so i have to read the end date entered by user and have to read it , add 5 hours to it, and then apply the filter.
    could you guide me how to read the values entered by the user.

  2. ravindar
    ravindar avatar
    4 posts
    Member since:
    Apr 2014

    Posted 24 Apr 2014 Link to this post

    by the way, i have tried following way
    but  i am getting string to Pair type conversion error
    if (e.CommandName == RadGrid.FilterCommandName)
    {
    Pair filterPair = (Pair)e.CommandArgument;
    gridMessage1 = "Current Filter function: '" + filterPair.First + "' for column '" + filterPair.Second + "'";
    TextBox filterBox = (e.Item as GridFilteringItem)[filterPair.Second.ToString()].Controls[0] as TextBox;
    gridMessage2 = "<br> Entered pattern for search: " + filterBox.Text;
    }





  3. ravindar
    ravindar avatar
    4 posts
    Member since:
    Apr 2014

    Posted 24 Apr 2014 in reply to ravindar Link to this post

    also i have tried following way. But this is not returning user entered value. Its returning default value set while page load

    for (i = 0; i < RadFilter1.RootGroup.Expressions.Count; i++)
                    {
                        RadFilterFunction filterFunction = RadFilter1.RootGroup.Expressions[i].FilterFunction; // the filter function that was used for filtering
                        string a = filterFunction.ToString();
                        string fieldName = RadFilter1.FieldEditors[i].FieldName;
                        if (fieldName == "InsertedDateTime")
                        {
                            //RadGrid1.MasterTableView.AllowCustomSorting = true;
                            //read existing filter
                            RadFilterNonGroupExpression nonGroupExpression = RadFilter1.RootGroup.FindByFieldName(fieldName);
                            RadFilterBetweenFilterExpression<System.DateTime?> expression = nonGroupExpression as RadFilterBetweenFilterExpression<System.DateTime?>;
                            string leftValue = expression.LeftValue.ToString();
                            System.DateTime? startdate = expression.LeftValue;
                            System.DateTime? enddate = expression.RightValue;

  4. ravindar
    ravindar avatar
    4 posts
    Member since:
    Apr 2014

    Posted 24 Apr 2014 in reply to ravindar Link to this post

    i fixed it by calling recreate method.
    RadFilter1.RecreateControl();
Back to Top