Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 13th, 2004, 02:22 AM
Authorized User
 
Join Date: Feb 2004
Location: Delhi, Delhi, India.
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.

__________________
-.. -..
  #2 (permalink)  
Old April 13th, 2004, 04:12 AM
Authorized User
 
Join Date: Apr 2004
Location: Nanjing, Jiangsu, China.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Mohammed
Default

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.


page1:
<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>
</span>

page2:
<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
Mohammed

-------------------------
No Pains,No Gains.
  #3 (permalink)  
Old April 13th, 2004, 07:49 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Mahulda, please post your code.

  #4 (permalink)  
Old April 13th, 2004, 02:45 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

mahulda,

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).

Peter
-------------------------
Work smarter, not harder
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:00 PM.


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