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 November 29th, 2004, 06:51 AM
Authorized User
 
Join Date: Sep 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default moving variable from one page to other

Hi all,

I am stuck in transfering some variables from one page to the other.

The whole picture is like this , I am intending to write code for the disscussion board.

When the user clicks any topic the user must be redirected to the details/reply page Along with the topic Id (So that the details must be fetched from the DB against that Topic ID).

The problem is that the list of topics is displayed in the datagtrid under "Topic Name" coulmn which is hyperlink coulmn. ON clicking the desired Topic I want to send "TopicId" variable.

I can send and receive the "Topic name" variable easily, as it is hyperlink and i can access it using query string on the other page.

But I need to send "TopicId" when there is a click on the "TopicName" coulmn. Also the TopicId is not visible in the datagrid, but it is there in my DB as PK.

Regards


 
Old November 30th, 2004, 12:16 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

There are several ways of doing this.

Method 1:

While Designing the grid, You can add a Hyperlink column and mention the url in the sql statemetnt. You need to construct the SQL statement in such a way that it also contains a column containing the URL which you want to do the redirect. You can also add the TopicID as the query string.
     Select TopicID, TopicName, '../Topics/TopicDetails.aspx?' + Cast(TopicID as Varchar) As URL From Topics

This can be the query for your grid and when you populate the grid, you add this url as the url of the hyperlink column.

Method 2:

You can add a template column and inside that template column add a linkbutton adn pass the TopicID as the CommandArgument to the OnCommand event of the linkbutton. In the OnCommand event, you can add code to redirect to the desired url with the TopicID as the querystring.

Regards
Ganesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
$_SESSION value gets cleared moving page to page crmpicco PHP How-To 1 November 3rd, 2007 10:04 AM
how to assign fo:page-number to a xsl:variable or jyotsnag XSLT 0 March 14th, 2006 01:49 AM
moving around a page ozPATT Excel VBA 1 October 17th, 2005 02:42 AM
sending variable value to page when submitted crmpicco Classic ASP Basics 1 May 4th, 2005 07:23 PM





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