473,402 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 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 1662
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.