locked
Child-Parent-Child DropDownList Relationship RRS feed

  • Question

  • User-2077557102 posted

    I have the following:

    Table A (Parent)
    FruitID-Column
    10, 20, 30, 40
    FruitType-Column
    Orange, Apple, Pear, Banana

    Table B (Child)
    DesertID-Column
    11, 12, 13, 22,23, 24,  33, 35, 36, 44, 45, 46
    DesertType-Column
    Sherbert, Cookies, Cake, Parfait, Muffins, Pie, Cobbler, Ice Cream, Pancakes, Pudding, Trifle, Brownies
    FruitID
    10, 20, 30, 40, 10, 20, 30, 40, 10, 20, 30, 40

    What I have working is an inverse parent-child relationship between DropDownListA (Table A) and DropDownListB (TableB).
    Meaning the first DropDownListB is associated with TableB. Initially DropDownListB shows all values, when a selection is made, DropDownLIstA is populated based on the
    IDs in TableB, with the associated ID-Value as the data value shown in the DropDownList box. 

    However, on Edit (I have a DetailsView object) DropDownListC is populated with a subset of TableB(DropDownListB), but the selected value is not the value that the user
    sees in the DropDownListC object, they see  those records associated with the ID, but in ascending order.

    I need for DropDownListB and DropDownListC to be in sync, at the same time, when DropDownListA selectedIndex is changed DropDownListC changes in response.

     Ayo

    Tuesday, July 15, 2008 1:43 PM

Answers

  • User-2077557102 posted

    I got it to work, after comparing the dropdownlist boxes I saw that I had left out, "SelectedValue= '<%# Bind("field") %>'> " from the dropdownlist.

     

    Ayo

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 16, 2008 3:36 PM

All replies

  • User848370396 posted

    I need for DropDownListB and DropDownListC to be in sync, at the same time, when DropDownListA selectedIndex is changed DropDownListC changes in response.

    YOur requirement is not clear. if your try to do it, if you get struck any where, it would be better rather than asking the entire proc. 

    Why can't you try to implement dropdwonlistA selectedindexchanged event to sync, the dropdownlistB and dropdownlistC

    to implement dropdownlistb 

    to get fruittype of a fruit -> select fruittype from tablea where fruitid= (select fruittypeid from fruits where fruitid = @fruitid) // where @fruitid is the selectedvalue of dropdownlistA,

    to implement dropdownlist c

    to get all the remaining fruits of the fruittype of selected fruit -> select fruits from tableb where fruitid <> @fruitid and fruittypeid = ( (select fruittypeid from fruits where fruitid = @fruitid)) order by fruitid asc

     

    Wednesday, July 16, 2008 12:58 AM
  • User-2077557102 posted

    I got it to work, after comparing the dropdownlist boxes I saw that I had left out, "SelectedValue= '<%# Bind("field") %>'> " from the dropdownlist.

     

    Ayo

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 16, 2008 3:36 PM