472,952 Members | 2,661 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,952 software developers and data experts.

Transfering data from page to page

Hi,

This may be a very trivial answer but I was wondering if it possible to
have a ASP.NET page and on a user click, it transfers to another page.
Rather than redirecting to the new page, I want to pass some data with
it. I know I can do it using sessions but is it possible doing it in a
different way.

Thanks in advance,
Shahid

Nov 19 '05 #1
1 1643
Shahid,

There are a few different methods depending on what type/length of data you
want to pass to the new page.

One of the simplest is to add the data to the Page.Context object like this:

Page 1:

Dim StringToTransfer As String = "My value to transfer (this could be any
type of object)"
Page.Context.Items.Add("MyKey", StringToTransfer)

Server.Transfer("page2.aspx")

Page 2:

Dim TransferredString As String = Ctype(Page.Context.Items.Item("MyKey"),
String)

Of course it would be more efficient to type the string with:
Page.Context.Items.Item("MyKey").ToString, but I wanted to show that any
object type could be passed within the context object.

One interesting possible drawback to this system is that page two gets
delivered to the client machine without the client receiving a redirect, so
the client's address will still read page1.aspx. Most of the time this isn't
an issue.
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Shahid Juma" <sh*********@gmail.com> wrote in message
news:11********************@g47g2000cwa.googlegrou ps.com...
Hi,

This may be a very trivial answer but I was wondering if it possible to
have a ASP.NET page and on a user click, it transfers to another page.
Rather than redirecting to the new page, I want to pass some data with
it. I know I can do it using sessions but is it possible doing it in a
different way.

Thanks in advance,
Shahid

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Niyazi | last post by:
Hi, I have BIG question and I gues it is the BEST question. I have a problem that I am guessing the best solution is to create some sort ..NET Services. This Service(s) must check every...
2
by: bernardpace | last post by:
Hi, I am writing a client server application using TcpClient and TcpListener classes. Now I need to transfer structured large amounts of data. I was thinking to transfer the data in an xml...
2
by: Piotr Karwatka | last post by:
Hi! I have a little problem an qeustion. In .NET Windows Forms I can do something like that: - i have forms - Form1 Form2, on first form i have TextBox1 control on 2nd form I have Button1...
2
by: Ben | last post by:
I used the following code to transfer some web control data from Page1.aspx to Page2.aspx. It is successful to get the TextBox.Text over, but the DropDownList data failed to appear in Page2. I...
1
by: suneet.taparia | last post by:
Hi, Can anyone help me in finding a method or some url by which I can transfer the data from one page to another page using javascript method without refershing the page. If anyone can help...
10
by: Walshi | last post by:
Hi all, I'm a relative newby to access and VBA etc. My forms and tables etc are working great and saving lots of time...However... I have two databases with the exact same table format. I want...
13
by: hexagram | last post by:
hi guys can anybody can teach me how to do this scenario Transfering Data of a form to a new form The Scenario is: I have a Delivery Receipt Form (Hardware) with a fields of the following ...
0
nomad
by: nomad | last post by:
Hello Everyone: I need some help with transfering a db from my computer to the host. I'm not to sure how to do this so that the webpage know where the db is at. Here is what I have... I'm using...
0
by: Ro | last post by:
I've been given the task of transfering data from an access db to sql server 2000. The previous access db was not structured very well so we reconstructed the tables in sql server 2000 to add...
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.