Solved

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

Posted on 2011-02-11
2
550 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) 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.…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

910 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

22 Experts available now in Live!

Get 1:1 Help Now