473,387 Members | 1,585 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

dropdownlist --> URL

Web form VS 2005...

DropDownList has text describing links and url's.

What I want to do is have the DropDownList1.SelectedIndexChanged event
perform a hyperlink to the Value in the control at the selected index
position.

I've looked high and low for an example of this under ASP.NET 2.0 but have
yet to find any thing close. What VB function do I use in the code behind
page event to trigger the lauch of a new instance of the browser to the url
specified in the index value of the DropDownList control?
Jan 5 '06 #1
2 1256
Ken Carter wrote:
Web form VS 2005...

DropDownList has text describing links and url's.

What I want to do is have the DropDownList1.SelectedIndexChanged event
perform a hyperlink to the Value in the control at the selected index
position.

I've looked high and low for an example of this under ASP.NET 2.0 but have
yet to find any thing close. What VB function do I use in the code behind
page event to trigger the lauch of a new instance of the browser to the url
specified in the index value of the DropDownList control?


I believe you will need to do this in javascript on the client side.
The server can not spawn a new instance of the browser.

chris
Jan 5 '06 #2
Some code to get you going...

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not Page.IsPostBack Then

Dropdownlist1.Attributes("onChange") = "doJump('" &
Dropdownlist1.ClientID & "');"
End If
End Sub

<script language="javascript">
<!--

function doJump(theID) {
var theElement = document.getElementById(theID);
var si = theElement.selectedIndex;
if (si > 0) {
theElement.selectedIndex = 0; //reset menu to default
window.location.href = theElement.options[si].value;
}
}

-->
</script>

<form id="Form1" method="post" runat="server">
....
<asp:dropdownlist id="Dropdownlist1" Runat="server"></asp:dropdownlist>
....
</form>

Greg

"Chris" <no@spam.com> wrote in message
news:ub**************@TK2MSFTNGP12.phx.gbl...
Ken Carter wrote:
Web form VS 2005...

DropDownList has text describing links and url's.

What I want to do is have the DropDownList1.SelectedIndexChanged event
perform a hyperlink to the Value in the control at the selected index
position.

I've looked high and low for an example of this under ASP.NET 2.0 but
have yet to find any thing close. What VB function do I use in the code
behind page event to trigger the lauch of a new instance of the browser
to the url specified in the index value of the DropDownList control?


I believe you will need to do this in javascript on the client side. The
server can not spawn a new instance of the browser.

chris

Jan 5 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: C | last post by:
Hi, I have a drop down on my aspx as below. In between my opening and closing tags I render out the Items by populating a variable with the items. <asp:DropDownList id="selProf"...
1
by: Amit Chandel | last post by:
I'm recompiling a VS2003 project in VS2002 (3rd party code, we still use VS2002 and cannot upgrade at this time). I've managed to reverse engineer all of the code except for the following...
6
by: Chris Fink | last post by:
Does anyone know it is possible to include a small image(.gif .jpeg) within a <SELECT><option> so that the user would see the option text as well as a little image(icon) in the option? I know this...
2
by: COHENMARVIN | last post by:
I'm leafing through a big book on asp.net, and I don't see any way to the following: 1. bind values and text to a dropdown 2. Also make the first line of the dropdown say something different. For...
5
by: Mark Rae | last post by:
Hi, Has the <asp:DropDownList> - <asp:ListItem> functionality changed in v2? In v1.1, the following works as expected: <asp:DropDownList ID="cmbStatus" Runat=server EnableViewState=False>...
2
by: John Smith | last post by:
I have this DataGrid: <asp:datagrid id="dg1" runat="server" AutoGenerateColumns="False"> <Columns> <asp:TemplateColumn HeaderText="SM"> <ItemTemplate> <asp:Label id="Label2" runat="server"...
2
by: John Smith | last post by:
I have this DataGrid: <asp:datagrid id="dg1" runat="server" AutoGenerateColumns="False"> <Columns> <asp:TemplateColumn HeaderText="SM"> <ItemTemplate> <asp:Label id="Label2" runat="server"...
1
by: spamguy | last post by:
I have a DataGrid and a column that changes into a DropDownList when edited: <columns> <asp:templatecolumn headertext="Role Type"> <itemtemplate> <asp:hyperlink id="hlinkRoleType"...
5
by: nzkks | last post by:
Hi I am using these: ASP.Net 2.0, VB.Net, Visual Studio 2005, SQL Server 2005, Formview controls In a ASP.Net form I have 20 textboxes and 20 dropdownlists(ddl). All ddl(s) are databound and get...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.