Solved

asp.net - dropdownlist....doesnt select new value...

Posted on 2011-02-11
2
556 Views
Last Modified: 2012-05-11
when I select a new value from the dropdownlist..it continues to stay the first one...and doesnt change...

here is the control:

<asp:DropDownList ID="DropDownList1" runat="server"
           DataTextField="campaign_name"
            DataValueField="campaign_name"
            onselectedindexchanged="DropDownList1_SelectedIndexChanged"
            AutoPostBack="True">
        </asp:DropDownList>

...once selected...

    Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim DDL_val As String
        Dim flag As String
        Dim TC_ID As String
       
        TC_ID = Session("SessionTC_ID")
        DDL_val = DropDownList1.SelectedIndex
        flag = "dataset"
       
        Session("sessionDDL") = DropDownList1.Text
0
Comment
Question by:GlobaLevel
2 Comments
 
LVL 9

Expert Comment

by:s_chilkury
ID: 34876978
Check this: even this has the same issue ..

http://forums.asp.net/t/1635851.aspx?PageIndex=3
0
 
LVL 23

Accepted Solution

by:
Rajkumar Gs earned 500 total points
ID: 34876988
Your dropdownlist is enabled with AutoPostBack. So when you select any item, PostBack occurs and Page_Load event will trigger.

Check in Page_Load event, whether dropdownlist binding code is outside IsPostBack check. If so on each Selection on Dropdownlist, dropdownlist will get rebind and lost its selection.
Page_Load Event
If (!IsPostBack)
{
 // Dropdownlist Bind Code should be here
}

Open in new window


Just verify this case
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

840 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