Solved

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

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

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.

Join & Write a Comment

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…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

760 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

20 Experts available now in Live!

Get 1:1 Help Now