tags:

views:

349

answers:

4

I have a Default.aspx that redirects to a Page1.aspx. My ddl is loaded and ordered from a database. How do I make the ddl selection show up on the page load depending on what the user selects on the Default page?

A: 

The best you can do is dropdownelement.focus();

Allen
what does this do?
I think I mis understood, I thought you wanted the drop down to show up as clicked / expanded / dropped down.
Allen
oh... I get it now. That would be right, but i dont think that is what i was going for
A: 

You need to pass the selection to Page1.aspx somehow, probably using the querystring or session state, before you do the redirect. Then set SelectedValue on the ddl on Page1 when it loads.

CodeMonkey1
+6  A: 

You will need to pass some kind of data from Default.aspx to Page1.aspx. I would suggest using a query string. So for example on Default.aspx you would redirect to:

Response.Redirect("~/Page1.aspx?selectValue=5");

And then on Page1.aspx in Page_Load you would do something like

myDropDownList.SelectedValue = Request.QueryString("selectValue");

Obviously you'll need to do some more checking on Page1.aspx to make sure Request.QueryString("selectValue") exists, etc. but you get the idea.

edit-this is C#, so added the semicolon ;)

routeNpingme
A: 

You will need to pass the default page ddl selection across to the page1 page by either a QueryString or maybe store it in a session variable.

cyberbobcat