How to populate up the listbox control, aqquire the user selection and navigate to the appropriate page?

Posted on 2005-05-17
Last Modified: 2010-04-07
Hi Guru's
I'm still new to and quite frankly confuses me with its at server vs at client terminology.
I need to populate a list box with three items:

Menu Choice 1
Menu Choice 2
Menu Choice 3

I then need the following to happen:
I need my user to click on an item and then press the OK button
the VB code picks up the selection and then navigates to the appropriate webpage:
Page1.aspx, Page2.aspx, Page3.aspx

My Question:  How to populate up the listbox control, aqquire the user selection and navigate to the appropriate page?

Thank you all!

Question by:tcalbaz
    LVL 23

    Accepted Solution

    <%@ Page Language="vb"%>
    <script language="VB" runat="server">
    Sub Page_Load(ByVal sender As Object,ByVal e As EventArgs)
          If Not IsPostBack Then
                Dim values As String() = New String() {"Page1.aspx","Page2.aspx","Page3.aspx"}
                MenuItems.DataSource = values
          End If
    End Sub

    Sub MenuItems_SelectedIndexChanged(ByVal sender As Object,ByVal e As EventArgs)
    End Sub
    <head><title>Menu Items</title></head>
    <form runat="server">
    <asp:ListBox Id="MenuItems" runat="server" AutoPostBack="True" OnSelectedIndexChanged="MenuItems_SelectedIndexChanged"></asp:ListBox>
    LVL 1

    Author Comment


    Thanks for the quick response!

    LVL 23

    Expert Comment

    no problems =)
    LVL 5

    Expert Comment


    Checkout this code....


    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    This video discusses moving either the default database or any database to a new volume.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now