"Carter" <eagletender2001 (AT) yahoo (DOT) com> wrote
Quote:
I have a header control at the top of my default page. On this control
there are 4 buttons, each one displays a corresponding panel.
There also is a drop down list with a list of counties. The list of
counties is filled from a dataset when the page loads. The user selects a
county, and then selects a button. Each time a button is selected, the
control reloads and the county selection is lost and is filled again, not
only taking a lot of time but losing the user's selection. How do I stop
the drop down list from loading each time? I have tried using If
ispostback, then FillCountyList, but it doesn't seem to matter. Thanks. |
First of all, I suggest you reproduce a simpler version of this problem,
like a form with one dropdown and one button, which doesn't do anything.
Second, it sounds like you are refilling the DropDownList on every postback.
Your Page_Load should probably look something like this:
private void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
// Load your datasets
DataBind(); // Binds loaded data to all controls
}
else
{
// You shouldn't need to load anything since data were saved in
ViewState
}
}
-----
John Saunders