drop down question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 2 drop downs on my screen the second one is displayed and populated
based on the selection of the first drop down.
The problem i'm having is that when a user selects something it keeps going
back to the first item in the list - in this case is Select Car.
How can I keep the users selection displayed in the drop down?
 
IGotYourDotNet said:
I have 2 drop downs on my screen the second one is displayed and populated
based on the selection of the first drop down.
The problem i'm having is that when a user selects something it keeps going
back to the first item in the list - in this case is Select Car.
How can I keep the users selection displayed in the drop down?


User RegisterStartupScript to write some JavaScript to the client that
slects the chosen value.

//Rutger
 
I was able to do this before without using JavaScript in .NET, i just can't
remember how i got it accomplished.
 
If your code to populate the dropdowns is in the Page_Load then make sure
you check for Postback or the initializing code will run everytime an event
posts back.

so do this (c#);

private void Page_Load
{
if(!IsPostBack)
{

//code to populate the dropdowns

}

}

That will prevent the code from reloading the dropdowns when you select from
the first dropdown.

Hope this helps,

Frank M.
 
Back
Top