Selecting an item in a Dropdown list from DB after insert

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SunnySnow29
    New Member
    • Feb 2008
    • 2

    Selecting an item in a Dropdown list from DB after insert

    Hi,

    I have a 2 drop down lists in C# populated with data from a SQL 2005 db.

    When a new item of data is inserted the second list must update to reflect the change (the first drop down list will always be unchanged by inserts) and the new value must become the selected value in drop down list 2. I use databind() after the form has autoposted back after the insert but the 1st and 2nd drop down lists default back to the first item in the list. I'm using detailsview throughout.


    Any help would be much appreciated.

    Cheers
  • abev
    New Member
    • Jan 2008
    • 22

    #2
    Originally posted by SunnySnow29
    Hi,

    I have a 2 drop down lists in C# populated with data from a SQL 2005 db.

    When a new item of data is inserted the second list must update to reflect the change (the first drop down list will always be unchanged by inserts) and the new value must become the selected value in drop down list 2. I use databind() after the form has autoposted back after the insert but the 1st and 2nd drop down lists default back to the first item in the list. I'm using detailsview throughout.


    Any help would be much appreciated.

    Cheers

    Sunny I am confused (more my fault than yours) but let me throw something out there.

    On load or however you choose initially, load the data in the first combobox. Then after the first combobox is selected, fill the 2nd (OnLeave, SelectedIndexCh anged).

    Comment

    • SunnySnow29
      New Member
      • Feb 2008
      • 2

      #3
      Hi,

      Oh, sorry, the orginal data is already populated in the second drop down box and is linked perfectly to the first. I just need to a) insert a the new item into the second drop down box and b) make the new item selected in the 2nd drop down list. Is that clearer?

      Cheers

      Comment

      Working...