Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 16th, 2006, 10:52 PM
Authorized User
 
Join Date: Jul 2003
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Onchange event with select box

Hi

I am new to .net just wanted to ask how to use the onchange event to link to a new page, i am using asp.net with vb.

i have 2 drop down list boxes but they are not going to the new page they are going to the same page and the only thing that changes is the value on the drop down select box.

<asp:DropDownList id="DropDownList1" runat="server" AutoPostBack="True">
<asp:ListItem value=""></asp:ListItem>
<asp:ListItem value="/2005/Section_1.aspx">Section 1</asp:ListItem>
<asp:ListItem value="/2006/Section_2.aspx">Section 2</asp:ListItem>
</asp:DropDownList>

<asp:DropDownList id="DropDownList2" runat="server" AutoPostBack="True">
<asp:ListItem value="/2005/page_1.aspx">Page 1 options</asp:ListItem>
<asp:ListItem value="/2005/page_2.aspx">Page 2 options</asp:ListItem>
<asp:ListItem value="/2005/page_3.aspx">Page 3 options</asp:ListItem>
<asp:ListItem value="/2005/page_4.aspx">Page 4 options</asp:ListItem>
<asp:ListItem value="/2005/page_5.aspx">Page 5 options</asp:ListItem>
</asp:DropDownList>

thanks for any advice.


 
Old April 16th, 2006, 11:29 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

I am assuming you want to display the page selected in DropDownList2. If so, you need to redirect once a selection is made in the dropdown. You need to create a SelectedIndexChanged event for DropDownList2 and do something like this in the code:

Response.Redirect(DropDownList2.SelectedValue)






Similar Threads
Thread Thread Starter Forum Replies Last Post
onChange event mcinar HTML Code Clinic 3 May 24th, 2007 08:46 PM
onChange Event mcinar Javascript 11 May 11th, 2007 09:38 AM
how to use onchange event of dropdownlist check_007 ASP.NET 2.0 Professional 2 February 16th, 2007 02:57 AM
Event:OnChange catchrohith Classic ASP Basics 0 November 3rd, 2006 12:52 AM
OnChange Event Doesn't Execute JLJones13 Javascript How-To 1 August 22nd, 2003 02:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.