Results 1 to 6 of 6

Thread: Dropdown list loses properties on post back

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Location
    England
    Posts
    64

    Dropdown list loses properties on post back

    Hi im trying to mimic the itemdata property from vb6 in asp.net.
    On post back it seems to lose all attributes?

    Initial Load:
    ? ddlCustomer.items(2).Attributes("ItemData")
    "3"
    On Post Back:
    ? ddlCustomer.items(2).Attributes("ItemData")
    Nothing


    Any way around this?

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Dropdown list loses properties on post back

    How are you populating the DDL? Are you repopulating on each page load?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Location
    England
    Posts
    64

    Re: Dropdown list loses properties on post back

    Nope i populate on initial page load and then leave it alone on post backs

  4. #4
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Dropdown list loses properties on post back

    Did you Code your DropDownlist population inside

    vb Code:
    1. If Not (Page.IsPostBack()) Then
    2.                    'Bind the List Here
    3.                 End If
    Please mark you thread resolved using the Thread Tools as shown

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Location
    England
    Posts
    64

    Re: Dropdown list loses properties on post back

    Its not actually bound. we have a routine that takes the dropdown list
    and populates it with data from a collection.

    as part of this i set
    ddlCustomer.items(2).Attributes("ItemData")

  6. #6
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Dropdown list loses properties on post back

    Post the other part of code
    Please mark you thread resolved using the Thread Tools as shown

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width