Solved

Basic C# and asp questions with oracle: #2

Posted on 2004-03-21
2
183 Views
Last Modified: 2010-04-15
how do i get the drop down lists to keep the value that was selected on a postback?
thanks
0
Comment
Question by:tricks801
2 Comments
 
LVL 12

Assisted Solution

by:esteban_felipe
esteban_felipe earned 250 total points
ID: 10646439
Hi tricks801,

1.- EnableViewState should be set to true (At page level, or control level)
2.- Bind your data only on first request
page_load(....)
if(!Page.IsPostBack)
{
    yourDropDownList.DataBind();
}

Esteban Felipe
www.estebanf.com
0
 
LVL 7

Accepted Solution

by:
jj819430 earned 250 total points
ID: 10650651
You only want to bind a control again when it is being manipulated on the backend.... such as you have a new set of values to throw into the drop down list.

Esteban has it that you are probably not checking for post-back. The other possibility is that you are manipulating the DDownList with another class in which case you will have to track what was the selected Item.
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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video discusses moving either the default database or any database to a new volume.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

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

17 Experts available now in Live!

Get 1:1 Help Now