ddl duplicating selected items on postback

Last post 03-27-2008 11:00 AM by smcirish. 3 replies.

Sort Posts:

  • ddl duplicating selected items on postback

    03-27-2008, 9:39 AM
    • Loading...
    • frist44
    • Joined on 03-01-2007, 1:38 PM
    • Posts 414

    We have a drop down that is used to filter items in a gridview. The ddl is set to autopostback and the selected value is used as a selection parameter in the SQL data source. However, when it posts back, the item selected in the ddl now appears in the list as it normally would, and again at the bottom of the list items in the ddl.

     The ddl is databound to another SQL data source, which pulls unique names from the table.

     Any ideas?

  • Re: ddl duplicating selected items on postback

    03-27-2008, 10:04 AM

    Are you adding the selected value back onto the list in the postback code?  That would do it. 

    If this answered your question, be sure to mark it as the answer. That way, everybody after you will know it's the answer also!
  • Re: ddl duplicating selected items on postback

    03-27-2008, 10:04 AM
    Answer
    • Loading...
    • frist44
    • Joined on 03-01-2007, 1:38 PM
    • Posts 414

    stupid, stupid, stupid...I figured it out.

  • Re: ddl duplicating selected items on postback

    03-27-2008, 11:00 AM
    • Loading...
    • smcirish
    • Joined on 04-16-2007, 5:27 PM
    • Texas
    • Posts 175

    If you are reloading the DropDown on postback, don't forget to clear the DD before re-adding the selected value.

                      dd_box.Items.Clear

     

    ~ Remember To Mark The Posts Which Helped You As The ANSWER ~
Page 1 of 1 (4 items)