drop down question

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?
 
R

Rutger Smit

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
 
G

Guest

I was able to do this before without using JavaScript in .NET, i just can't
remember how i got it accomplished.
 
F

Frank Mamone

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top