You could always place an anchor tag next to the page and focus on that instead...
Additionally, you could try changing the form action, but I'm not sure that would be successful: <body onload="document.formName.action += '#anchor';"> That may not respond the way you'd think it would, but it's worth a try. Other than that, if you *must* do a Response.Redirect, you could always store the DDL value in a cookie like EasyListBox does... Peter On 12/22/05, Gregory Fox <[EMAIL PROTECTED]> wrote: > > Peter, > > That works, but is there a way to not to put the focus on myDDL? I prefer > to > go alittle higher in the html. This way the it would act like a named > anchor. > > Thanks for your help. > > Greg > > _____ > > From: [email protected] > > Hi Greg(ory), > > You're right that according to the code below, you won't get any list > items without a selected value... which you won't get on > Response.Redirectunless you're using EasyListBox with CookieMemory > turned on. You could get > around this by leaving a "Case Else" in there, but it sounds like you're > in > the middle of a population when that happens. > > How about this? In your dropdown's OnSelectedIndexChanged event > handler > sub (server-side), you can send some Javascript back to focus on it, like > this: > > Page.RegisterStartupScript("gotoDDL", "<script language='javascript'> > document.getElementById('" & myDDL.ClientID & "').focus();</scr" & "ipt>") > > (that last concatenation is because a closing script tag in single-page > mode > will confuse the parser) > > Of course if you want to avoid postbacks to populate your lists, you > could roll your own client-side solution (see > http://easylistbox.com/listBoxResources.aspx ) or you might consider ELB ( > http://easylistbox.com/demoRelated.aspx?rl=af ) as a possible alternative. > > HTH, > > Peter > > On 12/22/05, Gregory Fox <[EMAIL PROTECTED]> wrote: > > > > Hi All, > > > > I have a series of dropdown box on the middle of a web page. When I > select > > an item it is to populate the next dropdown box. This works well, > however > > on > > the postback the page go to the top and I have to scroll down to the > > dropdowns. My question is is there a way to get back to the dropdown > boxes > > on the postback? > > > > I have tried using an anchor and in the vb code using a > > response.redirect("page.aspx#anchor"), it brings me back to the > dropdowns, > > but they are not populating. I think it has to do with the dropdown > being > > populated in the code using items.add("item") method. For example > > > > select case dropdown0.SelectedValue > > case 1 > > dropdown1.Items.Add("item1") > > dropdown1.Items.Add("item2") > > dropdown1.Items.Add("item3") > > case 2 > > dropdown1.Items.Add("item1") > > dropdown1.Items.Add("item2") > > dropdown1.Items.Add("item3") > > end select > > response.redirect("page.aspx#anchor") > > > > Any help is appreciated. > > > > Gregory D. Fox > > Liberty Web Hosting & Design > > <mailto:[EMAIL PROTECTED]> LibertyHosting.net [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor --------------------~--> Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/KIlPFB/vlQLAA/TtwFAA/saFolB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
