473,569 Members | 2,590 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Drop Down List and AutoPostBack. Really urgent. Thank You Very Much

Hello,

I have a Drop Down List with 3 options. I want to redirect to a new page
when an options is selected. I don't want to use a button. The redirection
should be fired when the option is selected.

I have an ASP.net / VB page with a Drop Down List named "my select" as
follows:

<asp:DropDownLi st AutoPostBack="t rue" ID="myselect" runat="server">
<asp:ListItem value="www.goog le.com">Google</asp:ListItem>
<asp:ListItem value="www.yaho o.com">Yahoo</asp:ListItem>
<asp:ListItem value="www.macr omedia.com">Mac romedia</asp:ListItem>
</asp:DropDownLis t>

Then i have this script:

<script runat="server">

Sub Page_Load(Sende r As Object, E As EventArgs)
if myselect.AutoPo stBack then
Response.Redire ct ("http://" &
myselect.items( myselect.Select edIndex).Value)
end if
End Sub

</script>

I looked in the .net and tryied several options but until now i wasn't able
to make it work

This seems really simple. I don't know what is going on and i need to
deliver this as soon as possible. Can you help me?

Thank You,
Miguel

Nov 18 '05 #1
2 1567
Hi Miguel,

Use the OnSelectedIndex Changed event of dropdownlist.
<asp:DropDownLi st AutoPostBack="t rue" ID="myselect" runat="server" OnSelectedIndex Changed="mysele ct_Change"> <asp:ListItem value="www.goog le.com">Google</asp:ListItem>
<asp:ListItem value="www.yaho o.com">Yahoo</asp:ListItem>
<asp:ListItem value="www.macr omedia.com">Mac romedia</asp:ListItem> </asp:DropDownLis t>
then you can write the handler as
void myselect_Change (Object sender, EventArgs e) {

}

--
Cheers!
Rajiv. R
Rajspace.Org

"Miguel Dias Moura" <in************ @27lamps.com> wrote in message
news:#x******** ******@TK2MSFTN GP12.phx.gbl... Hello,

I have a Drop Down List with 3 options. I want to redirect to a new page
when an options is selected. I don't want to use a button. The redirection
should be fired when the option is selected.

I have an ASP.net / VB page with a Drop Down List named "my select" as
follows:

<asp:DropDownLi st AutoPostBack="t rue" ID="myselect" runat="server">
<asp:ListItem value="www.goog le.com">Google</asp:ListItem>
<asp:ListItem value="www.yaho o.com">Yahoo</asp:ListItem>
<asp:ListItem value="www.macr omedia.com">Mac romedia</asp:ListItem> </asp:DropDownLis t>

Then i have this script:

<script runat="server">

Sub Page_Load(Sende r As Object, E As EventArgs)
if myselect.AutoPo stBack then
Response.Redire ct ("http://" &
myselect.items( myselect.Select edIndex).Value)
end if
End Sub

</script>

I looked in the .net and tryied several options but until now i wasn't able to make it work

This seems really simple. I don't know what is going on and i need to
deliver this as soon as possible. Can you help me?

Thank You,
Miguel


Nov 18 '05 #2
There was already a response in :

03/04/2004 -- Re: Jump Menu (DropDown Menu) in ASP.net. Can someone help
me out?
<script runat=server language=C#>
private void Page_Load(objec t sender, EventArgs e)
{
if (!IsPostBack)
{

}
}
private void DropDownList1_S electedIndexCha nged(object sender,
System.EventArg s e)
{
if (((DropDownList )sender).Select edValue != "")
Response.Redire ct(((DropDownLi st)sender).Sele ctedValue);
}

</script>

<body MS_POSITIONING= "GridLayout ">
<form id="Form1" method="post" runat="server" OnLoad="Page_Lo ad">
<asp:DropDownLi st id="DropDownLis t1" style="Z-INDEX: 101; LEFT: 184px;
POSITION: absolute; TOP: 184px"
runat="server" AutoPostBack="T rue"
OnSelectedIndex Changed="DropDo wnList1_Selecte dIndexChanged">
<asp:ListItem value="">select one...</asp:ListItem>
<asp:ListItem
value="http://www.bonsalunos. com">item1</asp:ListItem>
<asp:ListItem value="http://www.sapo.pt">it em2</asp:ListItem>
<asp:ListItem value="http://www.google.com" >item3</asp:ListItem>

</asp:DropDownLis t>
</form>
</body>

"Rajiv R" <ra************ ********@yahoo. com> wrote in message
news:e$******** ******@TK2MSFTN GP10.phx.gbl...
Hi Miguel,

Use the OnSelectedIndex Changed event of dropdownlist.
<asp:DropDownLi st AutoPostBack="t rue" ID="myselect" runat="server"

OnSelectedIndex Changed="mysele ct_Change">
<asp:ListItem value="www.goog le.com">Google</asp:ListItem>
<asp:ListItem value="www.yaho o.com">Yahoo</asp:ListItem>
<asp:ListItem

value="www.macr omedia.com">Mac romedia</asp:ListItem>
</asp:DropDownLis t>


then you can write the handler as
void myselect_Change (Object sender, EventArgs e) {

}

--
Cheers!
Rajiv. R
Rajspace.Org

"Miguel Dias Moura" <in************ @27lamps.com> wrote in message
news:#x******** ******@TK2MSFTN GP12.phx.gbl...
Hello,

I have a Drop Down List with 3 options. I want to redirect to a new page
when an options is selected. I don't want to use a button. The redirection should be fired when the option is selected.

I have an ASP.net / VB page with a Drop Down List named "my select" as
follows:

<asp:DropDownLi st AutoPostBack="t rue" ID="myselect" runat="server">
<asp:ListItem value="www.goog le.com">Google</asp:ListItem>
<asp:ListItem value="www.yaho o.com">Yahoo</asp:ListItem>
<asp:ListItem

value="www.macr omedia.com">Mac romedia</asp:ListItem>
</asp:DropDownLis t>

Then i have this script:

<script runat="server">

Sub Page_Load(Sende r As Object, E As EventArgs)
if myselect.AutoPo stBack then
Response.Redire ct ("http://" &
myselect.items( myselect.Select edIndex).Value)
end if
End Sub

</script>

I looked in the .net and tryied several options but until now i wasn't

able
to make it work

This seems really simple. I don't know what is going on and i need to
deliver this as soon as possible. Can you help me?

Thank You,
Miguel



Nov 18 '05 #3

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

Similar topics

8
2551
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and courses are populated. When course is selected, lists of occurrences, groups and
2
303
by: Miguel Dias Moura | last post by:
Hello, I have a Drop Down List with 3 options. I want to redirect to a new page when an options is selected. I don't want to use a button. The redirection should be fired when the option is selected. I have an ASP.net / VB page with a Drop Down List named "my select" as follows: <asp:DropDownList AutoPostBack="true" ID="myselect"...
13
5230
by: Leszek Taratuta | last post by:
Hello, I have several drop-down lists on my ASP.NET page. I need to keep data sources of these lists in Session State. What would be the most effective method to serialize this kind of data structures? Thanks for any hints, Leszek Taratuta
0
908
by: JohnZing | last post by:
Hi, i have a list of drop down lists. The first one is populated with a Select Query The Second one is populated with a select query where ParentID is the first drop down list selected value The Third.... and so on... The problem is: How can I handle the events from the different drop down lists?
6
2021
by: Joey Liang via DotNetMonster.com | last post by:
Hi all, I have a drop down list which store all the different brands of product.When i selected the particular brand from the drop down list, it will display all the products with the selected brand in a datagrid. I have this error when i select a brand from the drop down list. Blow is my code,anyone can help me to solve my error,which part...
7
6304
by: Miguel Dias Moura | last post by:
Hello, i have an ASP.NET / VB page where i have a few 4 groups of Drop Down Lists. Each group of Drop Down Lists include 3 Drop Down Lists for date such as: DAY, MONTH, and YEAR. I don't want to insert the values and text to each drop down list. So i want to create a script that populates a certain Drop Down List with certain values...
3
12475
by: Mike Collins | last post by:
I'm not feeling too smart right now, but I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. Can someone show me what I am doing wrong and tell me the correct way? Thank you. In the page load event, I am doing the following: //Code I use to populate the...
2
1462
by: newsgroups.jd | last post by:
Thanks for any advice, help in advance... I have 3 dropdownlist that populate based on choice in the previous (nested essentially) Problem is when I hit the back button and make a change in the second or thrid dropdownlist it does not always redirect to the correct site... What I really want to happen is if the back button is pushed...
8
7563
by: Ed Dror | last post by:
Hi there ASP.NET 2.0 VB & SQL Express Lest take Northwind Categories Products as example I create a table that hold these two together and I create a stored procedure like select ProductID, ProductName, CategoryID, from tblCategoryProducts Where (CategoryID = @CategoryID)
0
7615
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8130
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7979
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5514
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1223
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.