Bound dropdownlist inside DetailsView control not displaying ListItem added via Insert()

Discussion in 'ASP .Net' started by donet programmer, Oct 25, 2007.

  1. The dropdown list is created inside the EditItemTemplate of the
    DetailsView control. I am binding a dropdownlist to a dataset
    programatically when the user switches to the Edit mode. In the code
    after the binding the dropdown to the dataset, I insert a listitem at
    index 0, something like this :

    MyDDL.Items.Insert(0, new ListItem("-Select-", "-1"));

    When I run the code and change to Edit a record, I only see data bound
    items in the dropdown. This works great if I move the dropdown outside
    the DetailsView.

    I know there are ways to get around this, just wondering if this is a
    bug in .NET 2.0?? One would expect controls to be working the same way
    whether inside or outside a DetailsView, GridView controls
     
    donet programmer, Oct 25, 2007
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mad Scientist Jr
    Replies:
    2
    Views:
    683
    Mad Scientist Jr
    Jun 29, 2004
  2. Mario Krsnic
    Replies:
    0
    Views:
    558
    Mario Krsnic
    Jun 23, 2006
  3. cannontrodder
    Replies:
    1
    Views:
    955
    cannontrodder
    Jul 25, 2006
  4. Jim in Arizona
    Replies:
    7
    Views:
    1,179
    Badass Scotsman
    Nov 22, 2006
  5. RichB
    Replies:
    7
    Views:
    1,223
    Allen Chen [MSFT]
    Oct 17, 2008
  6. Tamer Ibrahim

    How can I access a calendar control inside a detailsview control?

    Tamer Ibrahim, Jan 29, 2007, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    1,062
    Alvin Bruney [MVP]
    Jan 30, 2007
  7. eagle

    Insert & Insert/Repeat buttons in a detailsview

    eagle, Jul 12, 2007, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    1,275
    eagle
    Jul 12, 2007
  8. Feege
    Replies:
    0
    Views:
    743
    Feege
    Dec 20, 2005
Loading...