Posted on 2005-04-22
Last Modified: 2008-01-09
I have a basic drop-down list on my page, auto postback set to true... with the below simple code on the selected index changed event i put the selected index into an int variable....

selected always returns as 0 (zero) regardless of the item selected. Or if I change to use a string with SelectedValue it always returns the first item in the list... Do I have to do something special to get it working???

private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
     int selected = DropDownList1.SelectedIndex;
Question by:nahguam
    1 Comment
    LVL 6

    Accepted Solution

    I believe you are populating the DropDownList1 in pageload event. So every time the page is posted, the dropdown gets populated. Try moving inside !IsPostBack

    void Page_Load()
        if (!IsPostBack)

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    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

    17 Experts available now in Live!

    Get 1:1 Help Now