Solved

Basic C# and asp questions with oracle: #2

Posted on 2004-03-21
2
188 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 Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

735 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