473,385 Members | 1,642 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,385 software developers and data experts.

hyperlinks as part of dropdownlist

Just wondering if there is a way to set up hyperlinks in a drop down list, so each item in the dropdown list navigates to a different page.
Nov 18 '05 #1
4 4798
CW
I don't know whether you want an immediate redirect to a page once user
selects an item from the drop down box or simply presents a URL for user to
go to.

Either way, you simply make sure to set the drop down box to autopostback.
If it's the former you require, simply call redirect method in the event
handler of the selectedindex_changed method of the drop down box. If the
latter, you need to have a second control (easiest being a hyperlink object
on the same web form) and set its navigateurl in the event handler of the
drop down box.

HTT
"Paul" <an*******@discussions.microsoft.com> wrote in message
news:A1**********************************@microsof t.com...
Just wondering if there is a way to set up hyperlinks in a drop down list,

so each item in the dropdown list navigates to a different page.
Nov 18 '05 #2
You can't exactly put hyperlinks in the list, but you could redirect
to a URL depending on what item the user has select in the control.

For example, if the following was in a web form:

<asp:DropDownList id="DropDownList1" runat="server">
<asp:ListItem Value="http://msdn.microsoft.com"
Selected="True">MSDN
</asp:ListItem>
<asp:ListItem Value="http://www.asp.net">ASP.Net
</asp:ListItem>
<asp:ListItem Value="http://www.google.com">Google
</asp:ListItem>
</asp:DropDownList>
<asp:Button id="Button1" runat="server" Text="Go"/>
Then you could add an event handler for the button click event and do
the following:

private void Button1_Click(object sender, System.EventArgs e)
{
Response.Redirect(DropDownList1.SelectedValue);
}

HTH,

--
Scott
http://www.OdeToCode.com

On Wed, 5 May 2004 07:51:03 -0700, "Paul"
<an*******@discussions.microsoft.com> wrote:
Just wondering if there is a way to set up hyperlinks in a drop down list, so each item in the dropdown list navigates to a different page.


Nov 18 '05 #3
Hi thanks for the response. I need to open a new window based on the selection, so may use window.open with some conditional code in the dropdown list change event.
Nov 18 '05 #4
ok thanks for the information.
Nov 18 '05 #5

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

Similar topics

5
by: KKramsch | last post by:
Suppose I want to set some color to match the color of (unvisited) hyperlinks, whatever this color may be (without explicitly setting this color, of course). How can I specify it? Thanks, ...
0
by: tdmailbox | last post by:
I have a access database appliaction that links to a sql back end. One column has a field that is always populated witha hyperlink. Since it is a linked table though it is stored as a varchar in...
6
by: Craig G | last post by:
i have the routine setup as below. the ctlCollection is populated with Page.Controls. but it only ever brings back 3 controls even though there is more than this on the page the control types it...
4
by: Seefor | last post by:
Hi, I want my text hyperlinks to have a dotted border underneath, so I did this which works fine: a, a:link, a:visited, a:hover, a:active { color: #000; text-decoration: none;
1
by: Robin | last post by:
Hello! I'm having trouble with links and hyperlinks in MS Access 2003 - any help would be great! Question 1! The "insert hyperlink" icon opens a browser window, allows the user to browse...
2
by: Tony Tone | last post by:
Hey Guys, I am trying to create a DropDownList with Hyperlinks as ListItem. I am creating a web page with ASP.NET and VB Any suggestions or Solutions to my problem?
1
by: polix | last post by:
Hi dear users I'm completly new in XML I'm trying to do the table with hyperlinks. Let me show you xml code (linki.xml) <?xml version="1.0" ?> <?xml-stylesheet type="text/xsl"...
1
by: castron | last post by:
Hi All, I'm trying to create a web part that will populate data in a drop down menu, I'm not sure how to pass the data from the method where I'm retrieving the data to the CreateChildControls...
9
Frinavale
by: Frinavale | last post by:
This has to be one of the most frustrating controls I've ever designed. First I couldn't stop the __doPostback method from executing for DropDownLists (ie select elements). Now the __doPostback...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.