473,748 Members | 4,030 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 1574
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
2581
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" runat="server">
13
5257
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
915
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
2026
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 of my code went wrong? Really thanx and very appreciate your help in advanced.. I have been stucked...
7
6313
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 when page loads such as:
3
12484
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 dropdown list. ddAssignedTo.DataValueField = "PersonnelID"; ddAssignedTo.DataTextField =...
2
1469
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 then everything clears and all starts from
8
7573
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
8831
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9548
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9374
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9325
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9249
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8244
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3315
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
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.