Redirecting Users dynamically from a hyperlink


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Redirecting Users dynamically from a hyperlink

  1. #1
    Tony Guest

    Redirecting Users dynamically from a hyperlink


    I have a list of tips and titles listed in a database. I need to display the
    entire list of titles, and then take the user to that tip after they click
    on the tip title. How can I pass the information needed to load that question
    from the database? Ideally, I'd like to be able to set a Session object
    to the database ID that I need to display, reload the page, and display the
    tip and answer.

    Thanks for the help.

  2. #2
    Tony Guest

    Re: Redirecting Users dynamically from a hyperlink


    "Tony" <tony.lenzi@relexsoftware.com> wrote:
    >
    >I have a list of tips and titles listed in a database. I need to display

    the
    >entire list of titles, and then take the user to that tip after they click
    >on the tip title. How can I pass the information needed to load that question
    >from the database? Ideally, I'd like to be able to set a Session object
    >to the database ID that I need to display, reload the page, and display

    the
    >tip and answer.
    >
    >Thanks for the help.


    Alright, I solved this one myself with a blend of ASP and JavaScript. I
    just created the list with an onClick event to open a new window ...?ID.
    Then I used the Request.QueryString to pull that ID off and pull the correct
    info from the database. If anyone knows of an easier way, please let me
    know.

  3. #3
    Russell Jones Guest

    Re: Redirecting Users dynamically from a hyperlink

    Use the primary key value for the rows to create a URL. If you don't have a
    primary key column, create one. For example, suppose the primary key for the
    first row is 1, the second is 2, etc. (there's no need for them to be
    numbers, nor for them to be sequential--in fact the primary key should be a
    meaningless value, a unique identifier for a row). When you build the list
    of links, append the primary key value to the URL. For example:
    do while not rs.eof
    Response.write "<a href='//yourserver/yourpage?ID=" & rs("id").value &
    "'>" & rs("title").value & "</a><br>"
    rs.movenext
    loop

    When the user selects a link, you can retrieve the selected ID from the
    Request.Form collection and use it to retrieve the desired tip.

    Russell Jones
    Sr. Web Development Editor,
    DevX.com

    "Tony" <tony.lenzi@relexsoftware.com> wrote in message
    news:3b0a7377$1@news.devx.com...
    >
    > I have a list of tips and titles listed in a database. I need to display

    the
    > entire list of titles, and then take the user to that tip after they click
    > on the tip title. How can I pass the information needed to load that

    question
    > from the database? Ideally, I'd like to be able to set a Session object
    > to the database ID that I need to display, reload the page, and display

    the
    > tip and answer.
    >
    > Thanks for the help.




  4. #4
    John Guest

    Re: Redirecting Users dynamically from a hyperlink


    Use an ADO connection to the database. Obtain the list of questions in a recordset.
    Loop through the recordset and dynamically assign the questions to a lable
    tag or button on the page that the user can select. In other words the button
    should display the question and assign the question to the value attribute.
    The form action should point back to the same page. At the top of the asp
    page use a set of case statements to pick out which button was picked and
    do a response redirect to the appropriate answer.


    "Tony" <tony.lenzi@relexsoftware.com> wrote:
    >
    >"Tony" <tony.lenzi@relexsoftware.com> wrote:
    >>
    >>I have a list of tips and titles listed in a database. I need to display

    >the
    >>entire list of titles, and then take the user to that tip after they click
    >>on the tip title. How can I pass the information needed to load that question
    >>from the database? Ideally, I'd like to be able to set a Session object
    >>to the database ID that I need to display, reload the page, and display

    >the
    >>tip and answer.
    >>
    >>Thanks for the help.

    >
    >Alright, I solved this one myself with a blend of ASP and JavaScript. I
    >just created the list with an onClick event to open a new window ...?ID.
    > Then I used the Request.QueryString to pull that ID off and pull the correct
    >info from the database. If anyone knows of an easier way, please let me
    >know.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center