Wrox Programmer Forums
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 13th, 2004, 02:22 AM
Authorized User
Join Date: Feb 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to mahulda
Default Linking Problems

I have created two pages
Page1 has a button which when clicked displays a list of links

Following a link I go to Page2. Among other things Page2 has a link that points back to Page1.

When I Click that link I go to Page1 which Displays only the button and not the links.
To view the links I have to click the button again.

I want the link to Display the page where the links are displayed.

-.. -..
Old April 13th, 2004, 04:12 AM
Authorized User
Join Date: Apr 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Mohammed

If you have a list of links diaplay by changing the value of style.display in page 1 then you can use asp script to get this goal.

<span id="list" style="display:'<%if request.querystring("pageback")<>"" then response.write("") else response.write("none") end if%>'">
<li><a href="page2.asp">page2</a>

<a href="page1.asp?pageback=1">page1</a>

when you first request the page1 without QueryString pageback so the span tag will not display.when you return to page1 by clicking the link in page2 it will pass the parameter pageback to page1.so the span tag will display.

sorry to my poor expression.

hopes to help

No Pains,No Gains.
Old April 13th, 2004, 07:49 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts

Mahulda, please post your code.

Old April 13th, 2004, 02:45 PM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts


You are falling victim to the stateless nature of the pages. As soon as you move to another page, you will loose the state of the first page (i.e. the state that makes the links visible). You will need to save this state in something that is maintained across pages like the session object.

In the onClick handler for the button where you show the links you should also set some session variable to preserve this state:

Session("Page1LinksVisible") = True

In the page_load() for this same page, you should check that session value and show the links if it's true. You'll want to only do this when the page is not in postback mode so it will only preset the page the "first" time it's hit (versus on a postback as in when you click a button).

If Not IsPostBack Then
   If Not Session("Page1LinksVisible") Is Nothing Then
      links.Visible = CType(Session("Page1LinksVisible"), Boolean)
   End If
End If

This is the typical methodology for saving information between pages and between page hits that are not postbacks (postbacks maintain state thru the use of the ViewState).

Work smarter, not harder

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wierd Linking problems with Xcode 2.3 scratt Xcode 0 June 8th, 2006 07:37 AM
linking anukagni Access 1 March 28th, 2006 08:21 AM
Linking servers bmains Oracle 1 February 5th, 2005 12:37 AM
RE: Linking sherr8 SQL Server 2000 2 July 30th, 2003 02:29 PM
Linking sherr8 Access 2 July 30th, 2003 02:29 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.