locked
Filter drop down only show data for exiting associations RRS feed

  • Question

  • User810924556 posted

     Hello,

     I was wondering if it would be possible to limit what the filters (Dropdown)  is showing.

    Let me explain:

    Context a products related to a category

    Let say I have 5 categories in the Category table. But all my products refer to only 3 of theme. I want my filter drop down list of categories to only show the one with a reference to it. Not the ones with no associations.

     How would I do that.

     

    Thanks,

    Luc

    Monday, December 8, 2008 11:34 AM

Answers

  • User-330204900 posted

    1-)  For some fileds I want to use the Default filter (regular drop downlist) I want to limit the numbers of items. I want for example, to list only the Categories that are actualy used by the Products: where categoryId IN (select categoryId from products). I have no clue where to put that

    This is the feature that I will be working on in the next few weeks.

    2-) Filters seems to work only with the AND clause could it work with OR clause as well example: a category OR another category

    This is all that there is at the moment DD V4 will offer a lot more but the new DataSource controls don't work with DD yet but hopefully after the Holidays maybe there will be another preview where they do work. But until then you caould give Josh Heyes's Dynamic Data Filtering on codeplex a go you will need SQL 2008 to run the sample, which is in the Source Code download, which I recommend you look at.

    I will also be doing some work with Dynamic Data Filtering soon also. (keep an eye on my blog for articles on these)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 9, 2008 7:54 PM

All replies

  • User-1413224888 posted

     you can filter them in your sql query to only get the distinct categories that match your product. provide db entities and i can attempt to write an sql query.

    Monday, December 8, 2008 11:47 AM
  • User154448021 posted

    please list the fields names in your product table and category table so that i could write a sql query for your purpose

    Monday, December 8, 2008 11:50 AM
  • User810924556 posted

     Thanks for all your answers. It is not how to build the SQL query but more on where in the framework can I change this query.

     

    Monday, December 8, 2008 12:35 PM
  • User154448021 posted

    what datasource do you use?

    Monday, December 8, 2008 12:42 PM
  • User810924556 posted

      I am sorry I am just beginning with this product... Where can I find the datasource type I am using.

    All I know is that it is connected to SQL 2000. 

    Monday, December 8, 2008 12:57 PM
  • User1641955678 posted

    You should be able to do this by writing some custom logic in your ~\DynamicData\Content\FilterUserControl.ascx.cs.  It calls PopulateListControl to populate the drop down, but you should be able to remove unwanted items programmatically.

    David

    Monday, December 8, 2008 3:09 PM
  • User-330204900 posted

    Hi Luc, Davids suggestion ig good but another option is to use the Advanced Filters from DynamicData Futures and then Add you own Filters that replace the standard ones.

    DD Futures Source Code DynamicDataFutures0716.zip

    Monday, December 8, 2008 6:20 PM
  • User-1005219520 posted

    See http://blogs.msdn.com/rickandy/archive/2008/09/25/tweaking-the-filter-repeater.aspx for a sample on modifying the contents of the FilterReapeater.

    Tuesday, December 9, 2008 1:34 AM
  • User810924556 posted

     Do you know if I'll be able to change the query?

    Tuesday, December 9, 2008 9:40 AM
  • User-330204900 posted

    You could create your own queries completely either via Linq Expressions (or just Linq if you create custom Filters using Advanced Filters from DD Futurs)

    Tuesday, December 9, 2008 10:03 AM
  • User810924556 posted

     Hello Steve,

     I was able to work the the new DynamicDataFutures project in reference to mine and it work fine but I still have some questions remaining:

    1-)  For some fileds I want to use the Default filter (regular drop downlist) I want to limit the numbers of items. I want for example, to list only the Categories that are actualy used by the Products: where categoryId IN (select categoryId from products). I have no clue where to put that

    2-) Filters seems to work only with the AND clause could it work with OR clause as well example: a category OR another category


     

    Tuesday, December 9, 2008 3:26 PM
  • User-330204900 posted

    1-)  For some fileds I want to use the Default filter (regular drop downlist) I want to limit the numbers of items. I want for example, to list only the Categories that are actualy used by the Products: where categoryId IN (select categoryId from products). I have no clue where to put that

    This is the feature that I will be working on in the next few weeks.

    2-) Filters seems to work only with the AND clause could it work with OR clause as well example: a category OR another category

    This is all that there is at the moment DD V4 will offer a lot more but the new DataSource controls don't work with DD yet but hopefully after the Holidays maybe there will be another preview where they do work. But until then you caould give Josh Heyes's Dynamic Data Filtering on codeplex a go you will need SQL 2008 to run the sample, which is in the Source Code download, which I recommend you look at.

    I will also be doing some work with Dynamic Data Filtering soon also. (keep an eye on my blog for articles on these)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 9, 2008 7:54 PM