Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > Visual Web Developer 2008
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Visual Web Developer 2008 Discuss creating ASP.NET 3.5 sites with Microsoft's Visual Web Developer 2008. If your question is more specific to a piece of code than the Visual tool, see the ASP.NET 3.5 forums instead. If your question is specific to the "Express Edition" be sure to state that in your post.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Web Developer 2008 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 24th, 2010, 10:34 PM
Authorized User
Points: 53, Level: 1
Points: 53, Level: 1 Points: 53, Level: 1 Points: 53, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2010
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Default need to bypass link to open destination page

I have a site on which members can select from a list of links (from a ListView in profiles.aspx) in order to view details of another site member (in profile_detail.aspx), using the following code:

profiles.aspx and profiles.aspx.vb:

Code:
<asp:LinkButton ID="lnkBtnItem" Text="Select" CommandArgument='<%#Eval("UserID") %>' OnCommand="lnkBtn_Command" ForeColor="#FF0000" Font-Bold="true" Font-Size="11px" runat="server" />
Code:
    Protected Sub lnkBtn_Command(ByVal sender As Object, ByVal e As CommandEventArgs)
        Session("UserID") = Convert.ToString(e.CommandArgument)
        Response.Redirect("~/profile_detail.aspx")
    End Sub

I would like to do the following tasks but need guidance:

From a completely different page (in other words, not from profiles.aspx this time), the user clicks on a photo of a site member; the program picks up the UserID associated with the photo from a database table and saves it to a session variable; completely bypasses the profiles.aspx page; goes directly to profile_detail.aspx and displays the correct person.

My problem: I don't how to bypass clicking the link on profiles.aspx.

In other words, I want to go directly to profile_detail.aspx and apply the UserID session variable in displaying the person who matches that UserID.

Any ideas?

Last edited by muybn; June 24th, 2010 at 10:37 PM..
  #2 (permalink)  
Old June 24th, 2010, 10:55 PM
Authorized User
Points: 53, Level: 1
Points: 53, Level: 1 Points: 53, Level: 1 Points: 53, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2010
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Default

OK, it appears that I have it working now. I had an error that came from a change I made in the Where parameters of the LinqDataSource in profile_detail.aspx so I thought I wasn't proceeding correctly.

What happens is that profiles.aspx page's links passes UserID through a session variable to open the correct profile in profile_detail.aspx, so apparently just going to that page from any page with a session variable equal to one of the UserIDs is good enough to display the desired profile.

Last edited by muybn; June 24th, 2010 at 10:58 PM..
  #3 (permalink)  
Old June 26th, 2010, 04:24 PM
Friend of Wrox
Points: 1,749, Level: 16
Points: 1,749, Level: 16 Points: 1,749, Level: 16 Points: 1,749, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2007
Location: San Diego, CA, USA.
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

Quote:
Originally Posted by muybn View Post
OK, it appears that I have it working now. I had an error that came from a change I made in the Where parameters of the LinqDataSource in profile_detail.aspx so I thought I wasn't proceeding correctly.

What happens is that profiles.aspx page's links passes UserID through a session variable to open the correct profile in profile_detail.aspx, so apparently just going to that page from any page with a session variable equal to one of the UserIDs is good enough to display the desired profile.
Absolutely correct. The profile_detail.aspx has the code to look and process the variable from the session.

So ANYWHERE in the application, you just need to store the correct userid in the session whenever someone selects a user; then just take them to the detail page and it should work fine.

FYI don't store too much in the Session since it takes up server resources. If you store big pieces of information in the session (like images, binary data, XML files, etc.) or on a large application with tons of users, this could cause problems - ie the more users and the more data the more server memory gets eaten up. The best practice to maintain scalability is to store just a custom session id and keep the rest of the data in the user's profile (usually a DB, but you can use whatever you want to persist the data) However, a few small pieces of alpha-numerical data like this are just fine for most applications.
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
 


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
Open link automatically in email collie HTML Code Clinic 2 May 28th, 2008 09:57 PM
double click to open link thutt Dreamweaver (all versions) 0 February 8th, 2007 05:01 PM
Button link in gridview to open a www kherrerab ASP.NET 2.0 Basics 0 September 28th, 2006 01:53 PM
Click on link to open file from .asp wolfberg Classic ASP Basics 4 November 22nd, 2004 04:18 PM
response.write open link in new window netcrawler Classic ASP Basics 10 October 25th, 2004 07:42 AM



All times are GMT -4. The time now is 03:30 AM.


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