AppendDataBoundItems for Dropdownlist

Last post 06-28-2007 1:28 PM by hseo11. 2 replies.

Sort Posts:

  • AppendDataBoundItems for Dropdownlist

    06-28-2007, 12:31 PM
    • Loading...
    • hseo11
    • Joined on 07-06-2006, 11:34 AM
    • Posts 39

    Hi

    I have a dropdownlist related to radiobutton's value. Since I want to add row in the dropdownlist, I set AppendDataBoundItems="True". Now I can see the new row added at the first row, but it shows all options regardless of radiobutton value.

    So, I took it out from design page, and put it in the code page

     

    Dropdownlist1.Items.Add("Choose A Location")

    Dropdownlist1.AppendDataBoundItems = True

    Dropdownlist1.DataBind()

     

    Now, what happens is if radiobutton's value is 1, dropdownlist has all locations for 1. Then, I choose radiobutton 2, dropdownlist shows all locations for 1 AND 2. If I choose 3 in radiobutton, dropdownlist has list for 1,2,and 3.

     How can I fix this problem?

     

    Thanks.

     

  • Re: AppendDataBoundItems for Dropdownlist

    06-28-2007, 1:15 PM
    Answer
    • Loading...
    • rmaiya
    • Joined on 06-25-2007, 11:08 PM
    • Olympia, WA
    • Posts 1,237

     Try this out.

     Dropdownlist1.Items.Clear();

    Dropdownlist1.Items.Add("Choose A Location")

    Dropdownlist1.AppendDataBoundItems = True

    Dropdownlist1.DataBind()

    Raghu
    (MCSD.NET, MCAD.NET, MCDBA)
    [Don't forget to click on Mark as answer on the post that helped you ]
  • Re: AppendDataBoundItems for Dropdownlist

    06-28-2007, 1:28 PM
    • Loading...
    • hseo11
    • Joined on 07-06-2006, 11:34 AM
    • Posts 39

    Thank you very much!

    It's working perfect!

Page 1 of 1 (3 items)
Microsoft Communities
Page view counter