473,406 Members | 2,371 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,406 software developers and data experts.

Jump Menu (DropDown Menu) in ASP.net. Can someone help me out?

Hello,

i have a drop down menu in ASP.net with 5 options. I want to redirect to a
certain page when a certain option is selected.
I want to be redirected without having to click a button. Does anyone knows
how to make this?

Thank You,
Miguel
Nov 18 '05 #1
5 2942
<asp:DropDownList /> have AutoPostBack property. If this property is set to
true it automatically when change the List value fire a SelectedIndexChanged
event on Page.

In this method you can switch the DropDownList.SelectedValue and make a
Redirect where you want.

Brun
"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:OP**************@TK2MSFTNGP11.phx.gbl...
Hello,

i have a drop down menu in ASP.net with 5 options. I want to redirect to a
certain page when a certain option is selected.
I want to be redirected without having to click a button. Does anyone knows how to make this?

Thank You,
Miguel

Nov 18 '05 #2
<asp:DropDownList /> have AutoPostBack property. If this property is set to
true it automatically when change the List value fire a SelectedIndexChanged
event on Page.

In this method you can switch the DropDownList.SelectedValue and make a
Redirect where you want.

Brun
"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:OP**************@TK2MSFTNGP11.phx.gbl...
Hello,

i have a drop down menu in ASP.net with 5 options. I want to redirect to a
certain page when a certain option is selected.
I want to be redirected without having to click a button. Does anyone knows how to make this?

Thank You,
Miguel

Nov 18 '05 #3
Hi,

i wrote this script but it's not working as i expected. Can you tell me what
am i doing wrong?

<script runat="server">

Sub Page_Load(Sender As Object, E As EventArgs)
if myselect.AutoPostBack then
Response.Redirect ("http://" &
myselect.items(myselect.SelectedIndex).Value)
end if
End Sub

</script>

Drop Down Menu:

<asp:DropDownList AutoPostBack="true" ID="myselect" runat="server">
<asp:ListItem value="www.bonsalunos.com">item1</asp:ListItem>
<asp:ListItem value="www.sapo.pt">item2</asp:ListItem>
<asp:ListItem value="www.google.com">item3</asp:ListItem>
</asp:DropDownList>

Thanks,
Miguel

"Bruno Sirianni" <br***********@virgilio.it> wrote in message
news:Z_*******************@news3.tin.it...
<asp:DropDownList /> have AutoPostBack property. If this property is set to true it automatically when change the List value fire a SelectedIndexChanged event on Page.

In this method you can switch the DropDownList.SelectedValue and make a
Redirect where you want.

Brun
"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:OP**************@TK2MSFTNGP11.phx.gbl...
Hello,

i have a drop down menu in ASP.net with 5 options. I want to redirect to a certain page when a certain option is selected.
I want to be redirected without having to click a button. Does anyone

knows
how to make this?

Thank You,
Miguel


Nov 18 '05 #4
Hi,

i wrote this script but it's not working as i expected. Can you tell me what
am i doing wrong?

<script runat="server">

Sub Page_Load(Sender As Object, E As EventArgs)
if myselect.AutoPostBack then
Response.Redirect ("http://" &
myselect.items(myselect.SelectedIndex).Value)
end if
End Sub

</script>

Drop Down Menu:

<asp:DropDownList AutoPostBack="true" ID="myselect" runat="server">
<asp:ListItem value="www.bonsalunos.com">item1</asp:ListItem>
<asp:ListItem value="www.sapo.pt">item2</asp:ListItem>
<asp:ListItem value="www.google.com">item3</asp:ListItem>
</asp:DropDownList>

Thanks,
Miguel

"Bruno Sirianni" <br***********@virgilio.it> wrote in message
news:Z_*******************@news3.tin.it...
<asp:DropDownList /> have AutoPostBack property. If this property is set to true it automatically when change the List value fire a SelectedIndexChanged event on Page.

In this method you can switch the DropDownList.SelectedValue and make a
Redirect where you want.

Brun
"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:OP**************@TK2MSFTNGP11.phx.gbl...
Hello,

i have a drop down menu in ASP.net with 5 options. I want to redirect to a certain page when a certain option is selected.
I want to be redirected without having to click a button. Does anyone

knows
how to make this?

Thank You,
Miguel


Nov 18 '05 #5
Try with this :

<script runat=server language=C#>
private void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

}
}
private void DropDownList1_SelectedIndexChanged(object sender,
System.EventArgs e)
{
if (((DropDownList)sender).SelectedValue != "")
Response.Redirect(((DropDownList)sender).SelectedV alue);
}

</script>

<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server" OnLoad="Page_Load">
<asp:DropDownList id="DropDownList1" style="Z-INDEX: 101; LEFT: 184px;
POSITION: absolute; TOP: 184px"
runat="server" AutoPostBack="True"
OnSelectedIndexChanged="DropDownList1_SelectedInde xChanged">
<asp:ListItem value="">item0</asp:ListItem>
<asp:ListItem
value="http://www.bonsalunos.com">item1</asp:ListItem>
<asp:ListItem value="http://www.sapo.pt">item2</asp:ListItem>
<asp:ListItem value="http://www.google.com">item3</asp:ListItem>

</asp:DropDownList>
</form>
</body>

"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:ej**************@TK2MSFTNGP11.phx.gbl...
Hi,

i wrote this script but it's not working as i expected. Can you tell me what am i doing wrong?

<script runat="server">

Sub Page_Load(Sender As Object, E As EventArgs)
if myselect.AutoPostBack then
Response.Redirect ("http://" &
myselect.items(myselect.SelectedIndex).Value)
end if
End Sub

</script>

Drop Down Menu:

<asp:DropDownList AutoPostBack="true" ID="myselect" runat="server">
<asp:ListItem value="www.bonsalunos.com">item1</asp:ListItem>
<asp:ListItem value="www.sapo.pt">item2</asp:ListItem>
<asp:ListItem value="www.google.com">item3</asp:ListItem>
</asp:DropDownList>

Thanks,
Miguel

"Bruno Sirianni" <br***********@virgilio.it> wrote in message
news:Z_*******************@news3.tin.it...
<asp:DropDownList /> have AutoPostBack property. If this property is set to
true it automatically when change the List value fire a

SelectedIndexChanged
event on Page.

In this method you can switch the DropDownList.SelectedValue and make a
Redirect where you want.

Brun
"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:OP**************@TK2MSFTNGP11.phx.gbl...
Hello,

i have a drop down menu in ASP.net with 5 options. I want to redirect
to a certain page when a certain option is selected.
I want to be redirected without having to click a button. Does anyone

knows
how to make this?

Thank You,
Miguel



Nov 18 '05 #6

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

Similar topics

4
by: Simon Birch | last post by:
Hi, I hope someone can help with this, it is driving me bonkers. After reading the Suckerfish Dropdown article on A List Apart, I decided to try and create a side menu based on the code I'd seen....
3
by: Miguel Dias Moura | last post by:
Hello, i have a drop down menu in ASP.net with 5 options. I want to redirect to a certain page when a certain option is selected. I want to be redirected without having to click a button. Does...
2
by: Calvin KD | last post by:
Hi everyone, Can someone show me or point me in the right direction as how to create a "dropdown menu" which displays the menu items as a separete layer over the top of the contents of the page...
3
by: ACaunter | last post by:
Hi there, can someone please tell me what the easiest way to have a dropdown menu bar positioned on the screen (eg. Home, company, ... , contact us) then when the mouse goes over then, the sub...
8
by: gs | last post by:
I was able to set tooltips on objects other than main menu. I would like to get the effect of tooltip or microhelp in the bottom status bar when the mouse is hovering over a submenu item. How do...
3
by: mckbill | last post by:
Is there a way I can direct the cursor to a specific field (variable) in a form by typing the field name while in form view? I have a form with many fields, and it would be nice if there were...
19
by: Jim | last post by:
Hi, I have two questions/problems pertaining to CSS horizontal dropdown menus and am hoping that someone here can help me out. (1) I'm having a problem centering the menu. I picked up the...
13
by: PetterL | last post by:
I writing a program where I read menu items from a file. But I have problem when I click an menu item i want it to mark that one as checked but I cant access the menu object of that item to see...
2
by: dorayme | last post by:
After posting similar in another forum a few hours ago, it strikes me I should have subscribed to this group and included it here. There may be a simple js tweak that someone knows or can think of:...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.