Solved - dropdown doesnt return the value the user clicks on...

Posted on 2011-05-09
Last Modified: 2012-05-11
I have a dropdownlist that lists the states....yet when the user clicks a state...that value doesn't post...
Question by:GlobaLevel
    LVL 10

    Author Comment

    its a postback issue it gets written over on postbakc and I cant remember how to solve
    LVL 11

    Expert Comment

    Hello, You should change the property IsPostBack = Enable
    LVL 16

    Accepted Solution


    in your design and code page try the following snippet

    Set AutoPostBack=true for that dropdownlist

    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">

    Open in new window

    getting selected data from dropdownlist

    Sub Page_Load
        If Not IsPostBack
            Dim state as string =  "Selected Text: " _
            & ddlState.SelectedItem.Text & " Selected Value: " _
            & ddlState.SelectedItem.Value & " Selected Index: " _
            & ddlState.SelectedIndex   
        End If
    End Sub

    Open in new window

    public void Page_Load()
    	if (!IsPostBack) {
    		string state = "Selected Text: " + ddlState.SelectedItem.Text;
    		state += " Selected Value: " + ddlState.SelectedItem.Value; 
    		state += "<BR>Selected Index: " + ddlState.SelectedIndex;

    Open in new window

    Happy Programming.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    759 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

    11 Experts available now in Live!

    Get 1:1 Help Now