473,385 Members | 1,569 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.

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 2940
<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:...
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: 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:
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...
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...

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.