locked
filtering multilevel table with lindatasource RRS feed

  • Question

  • User560206892 posted

    hi,

    i have a two tables in my database products and categories with this schema :

    CREATE TABLE [dbo].[CATEGORIES](
    [ID_CATEGORIE] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY ,
    [CAT_ID_PARENT] [int] NULL,
    [CAT_DESIGNATION] [varchar](150) NOT NULL,
    [CAT_LEVEL] [int] NULL

    and the  products table like this :

    CREATE TABLE [dbo].[PRODUITS](
    [ID_PRODUIT] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY,
    [PRD_ID_CATEGORIE] [int] NOT NULL,    /*     the foreign key   */
    [PRD_DESIGNATION] [varchar](150) NOT NULL,
    [PRD_IMAGE] [varchar](150) NULL 

    please note that the first table store the categories in a multi level relation

    and the products table contains a foreign key wich is the primary key of the first table,

    now the problem is how to filter the products table based on any level of the category table

    thanks and good day

    Wednesday, February 13, 2013 4:50 AM

Answers

  • User3866881 posted

    now how to select all the graphic cards when i select the hardware node ...

    Hi,

    It seems that you wanna do a Multiple-Tree's Multiple CheckBoxes selecting……

    You have to use rescuive to loop which item is checked, and then mark all of its children nodes' checked.

    For more you can download this sample to see:

    http://forums.asp.net/t/976122.aspx/1/10

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 14, 2013 5:48 AM

All replies

  • User-1801537205 posted

    Hi,

    You can use Sql Joins to get your result.

    Ex:

    Select * from [dbo].[PRODUCTS] Join [dbo].[CATEGORIES] on [dbo].[PRODUCTS].[PRD_ID_CATEGORIE] = [dbo].[CATEGORIES].[ID_CATEGORIE] Where [dbo].[CATEGORIES].[CAT_LEVEL]="<your value here>"

    Wednesday, February 13, 2013 4:57 AM
  • User560206892 posted

    it's more complicated :(

    suppose that i have these categories :

    [1] hardware

          |_______________  [3] graphic cards

                                           |_________________________________[5]  AMD

                                           | ________________________________[7]   NVIDIA

    [2] software

    i have a treeview populated with these categories ,

    now how to select all the graphic cards when i select the hardware node ...

    Wednesday, February 13, 2013 5:34 AM
  • User3866881 posted

    now how to select all the graphic cards when i select the hardware node ...

    Hi,

    It seems that you wanna do a Multiple-Tree's Multiple CheckBoxes selecting……

    You have to use rescuive to loop which item is checked, and then mark all of its children nodes' checked.

    For more you can download this sample to see:

    http://forums.asp.net/t/976122.aspx/1/10

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 14, 2013 5:48 AM