keep dropdown list items when postback...tricky part--items added through client side!

Posted on 2005-04-25
Last Modified: 2010-04-17
Hello everyone.  I have a server dropdown list in page.  I added the items dynamically through client side code.  If I want to keep the values during would I be able to do that? Thanks.
Question by:thiennhien
    LVL 13

    Accepted Solution

    I'm going out on a limb and assuming you're using ASP.NET.

    If you are, you would add the following to your page load sub:

     If Not IsPostBack Then
      End If

    I made a subroutine to bind the data to my ddl, and just call it through that.  

    Basically, you just want to put your binding code inside the "If not IsPostBack" statement.

    Author Comment

    The data cannot be binded because I am using client side code (Javascript) to add the items dynamically. Thanks anyway.
    LVL 13

    Expert Comment

    Well, it really doesn't matter what you are using to get the data there.  As long as you call within that if statement

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    format the code in java 6 60
    fizzArray3  challenge 1 47
    count8 challlenge 13 69
    delphi parse string to params 3 49
    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    A short article about problems I had with the new location API and permissions in Marshmallow
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now