Setting filter function via custom FieldEditor

3 posts, 0 answers
  1. Josh Turpen
    Josh Turpen avatar
    6 posts
    Member since:
    May 2009

    Posted 20 May 2011 Link to this post

    I've created a custom field editor which has:

    Two radio buttons, radio1, radio2 with autopostback = true
    A text box
    A combo box (as described in the demo :

    I have it coded like this:

    When radio1 is selected, the textbox is visible, and the filter functions are EqualTo, NotEqualTo, Contains, Between, etc. 
    When radio2 is selected, the combo box is visible, and the only filter function is EqualTo.

    My problem is when radio2 is selected, I can't figure out how to set the selected filter to EqualTo.  For example, If radio1 is selected and the selected filter function is 'Contains', and then they select radio2, I can't set the selected filter to 'EqualTo'.  I can reduce the options available in the context menu successfully when radio2 is clicked, but I can't set the selected filter.

    Please help :)

  2. Radoslav
    Radoslav avatar
    1564 posts

    Posted 26 May 2011 Link to this post

    Hi Josh,

    Unfortunately the RadFilter could not support the desired functionality. You could not change the filter function on radio button click. Also the filter function depends on the field data type by which the data will be filtered. You could only change the initial filter function by using the following code snippet:
    void RadFilter1_ItemCommand(object sender, RadFilterCommandEventArgs e)
            if (e.CommandName == RadFilter.AddExpressionCommandName)
                e.Canceled = true;
                RadFilterContainsFilterExpression item = new RadFilterContainsFilterExpression(RadFilter1.FieldEditors[0].FieldName);
                (e.ExpressionItem as RadFilterGroupExpressionItem).Expression.AddExpression(item);

    This will select the "Contains" filter function as default function.

    I hope this helps.

    Best wishes,
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. Josh Turpen
    Josh Turpen avatar
    6 posts
    Member since:
    May 2009

    Posted 26 May 2011 Link to this post

    Thanks for the update.
Back to Top