Multiple custom field editors per field

2 posts, 0 answers
  1. Tom Rasmussen
    Tom  Rasmussen avatar
    20 posts
    Member since:
    Jan 2009

    Posted 19 Sep 2012 Link to this post

    I am working on using the RadFilter as a type of SQL expression builder for my application.  The existing RadFilter functionality gets me most of the way there and I am attempting to fill in the last bits I need which are :

    1. The ability to compare a field to another field (e.g. FieldA >= FieldB)
    2. The ability to compare date fields to dynamic values (e.g. DateFieldA >= Previous X days)
    3. The ability to compare a field to a user supplied value at runtime (e.g. FieldA = prompt input)

    I know these are not really doable with the current RadFilter, but here is my theory:

    1. Customize each editor type (datetime, text, numeric and boolean) to include a control that would prompt for the type of comparison whether it is against a fixed value, database field, special date option or a prompt.  Mockup image (also attached)
    2. Wire an AJAX postback on the previous control that would reinitialize the editor with the appropriate supplemental controls.  For example, if a datetime field using value comparison, show the datetime pickers.  If a field to field comparison, show a combox box of other datetime fields.  If a special comparison show a combo box of presets (current month, previous month, etc.).  If a user prompt a simple text box for the prompt text.
    3. Output the values of each custom option in a specific format recognizable on the backend.  For example, field to field comparisons could write to the resulting expression as FieldA >= '[Field].[FieldB]', or specials as DateFieldA >= '[Special].[PreviousX]', or prompt as FieldA = '[Prompt].[Inputted prompt text]'.
    4. Parse the resulting SQL after running through the standard provider for each of these options and handle reformatting the expression through my own secondary SQL provider.

    So, my first question is, does this seem possible with the current RadFilter infrastructure?  In particular I am concerned about item 2 above.  I am currently working on item 2 and it seems that the editor is initialized prior to the handling of the combo box index change event.

    I would also need to make sure the system is able to appropriately handle friendly display to the screen as well as saving and loading the expression.


  2. Antonio Stoilkov
    Antonio Stoilkov avatar
    530 posts

    Posted 24 Sep 2012 Link to this post

    Hi Tom,

    Unfortunately, RadFilter control infrastructure is not designed for such customization. For example when creating custom field editor and overriding InitializeEditor method there is no access of previously selected combo box value which limits the implementation and does not allow for specific code depending on the selected type of compassion. Additionally, there are many cases where big and non maintainable workarounds are required which will not ensure that all cases will function correctly.

    Antonio Stoilkov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. DevCraft R3 2016 release webinar banner
Back to Top