473,480 Members | 2,194 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to pass a parameter between pages?

Hello, I have a question about how to pass information between pages in

ASP.NET. There are 2 pages : page1.aspx, page2.aspx.
On page1 user clicks the record. Then, I need to show the detailed info

about that record in page2. How to pass the ID of record? Should I use

querystring or cookies or session variable?

The problem is:
1. I don't want to use query string at all :^(

2. There is no need to create the cookie or session variable for a

certain time, I only want to pass the int number from page1 to page2. :^(

3. It seems to me that the best way to solve that is to pass number via

page header. I use this sintax: :^(

in page1:
Response.AppendHeader("recordID","123");
Response.Redirect("page2.aspx");

in page2 on page load event:
Label1.Text=Request.Headers["recordID"].ToString(); //oh... :=(

But that doesn't work. May be wrong caching parameters? I've tried to set

Response.Cache.SetCacheability(HttpCacheability.No Cache), but that didn't

work too.

4. I think other suggested methods are too resource-expensive, why don't

use headers?

Oh, could somebody please explain me how to solve the situation?

Thanks a lot for Your attention and reading my message :^)

Andriy
Nov 18 '05 #1
7 2200
ee****@list.ru (Spongebob) wrote in
news:c3*************************@posting.google.co m:
The problem is:
1. I don't want to use query string at all :^(
No, that would be bad. You need to minimize the data you pass about.
3. It seems to me that the best way to solve that is to pass number via

page header. I use this sintax: :^(

in page1:
Response.AppendHeader("recordID","123");
Response.Redirect("page2.aspx");


Pass it in the URL. Something like:
Response.Redirect("page2.aspx?RecordID=123");

--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
ELKNews - Get your free copy at http://www.atozedsoftware.com

Nov 18 '05 #2
lol... well the reason why i ignored the post was that he did not want to
use query string.
he didnot want to use session...
well mate.. wait for asp.net 2.0.. you have cross page posting when you can
post from one aspx page to another without resorting to query string or
session
btw.. session isnt so bad... you can always set it to nothing after you are
done reading it.

--
Regards,
HD
Once a Geek.... Always a Geek
"Chad Z. Hower aka Kudzu" <cp**@hower.org> wrote in message
news:Xn******************@127.0.0.1...
ee****@list.ru (Spongebob) wrote in
news:c3*************************@posting.google.co m:
The problem is:
1. I don't want to use query string at all :^(


No, that would be bad. You need to minimize the data you pass about.
3. It seems to me that the best way to solve that is to pass number via

page header. I use this sintax: :^(

in page1:
Response.AppendHeader("recordID","123");
Response.Redirect("page2.aspx");


Pass it in the URL. Something like:
Response.Redirect("page2.aspx?RecordID=123");

--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
ELKNews - Get your free copy at http://www.atozedsoftware.com

Nov 18 '05 #3
"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in
news:Ou**************@TK2MSFTNGP12.phx.gbl:
lol... well the reason why i ignored the post was that he did not want
to use query string.
Sorry, when I read query I thought SQL. I didnt understand that he meant the
GET / URL string.
well mate.. wait for asp.net 2.0.. you have cross page posting when you
can post from one aspx page to another without resorting to query string
or session


How does this work exactly in asp.net 2?
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
ELKNews - Get your free copy at http://www.atozedsoftware.com

Nov 18 '05 #4
well in 2.0 you have a new feature which allows you to post to a different
aspx page.
you have something called previouspage (within the page that received the
post) which is used to partially instantiate the aspx class (that caused the
post to the second aspx class or page however you put it).
once it is partially instantiated.. you can read the variables within the
instance.

--
Regards,
HD
Once a Geek.... Always a Geek
"Chad Z. Hower aka Kudzu" <cp**@hower.org> wrote in message
news:Xn******************@127.0.0.1...
"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in
news:Ou**************@TK2MSFTNGP12.phx.gbl:
lol... well the reason why i ignored the post was that he did not want
to use query string.


Sorry, when I read query I thought SQL. I didnt understand that he meant
the
GET / URL string.
well mate.. wait for asp.net 2.0.. you have cross page posting when you
can post from one aspx page to another without resorting to query string
or session


How does this work exactly in asp.net 2?
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
ELKNews - Get your free copy at http://www.atozedsoftware.com

Nov 18 '05 #5
"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in
news:OS**************@tk2msftngp13.phx.gbl:
well in 2.0 you have a new feature which allows you to post to a
different aspx page.
you have something called previouspage (within the page that received
the post) which is used to partially instantiate the aspx class (that
caused the post to the second aspx class or page however you put it).
once it is partially instantiated.. you can read the variables within
the instance.


So if I understand you it works this way:

On post an event in the new page is fired.

From this event I can access the variables from the last page.

But I have to read all the variables - ie it elimiates postback type things
correct?

So its very simlilar to what we have now, you are just defining where to go
before hand, and the event is fired on that page instead.

Is this correct?
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
ELKNews - Get your free copy at http://www.atozedsoftware.com

Nov 18 '05 #6
yeap but the page has to be within the same application right now
http://weblogs.asp.net/pwilson/archi.../29/34597.aspx

you create a partial instance of posting class in the in the page that
received the post..
yes but right now you dont have a way of posting it to anothe page... unless
you put them in a query string and do a response.redirect. or put them in
session so that the other page you call can read it..

--
Regards,
HD
Once a Geek.... Always a Geek
"Chad Z. Hower aka Kudzu" <cp**@hower.org> wrote in message
news:Xn******************@127.0.0.1...
"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in
news:OS**************@tk2msftngp13.phx.gbl:
well in 2.0 you have a new feature which allows you to post to a
different aspx page.
you have something called previouspage (within the page that received
the post) which is used to partially instantiate the aspx class (that
caused the post to the second aspx class or page however you put it).
once it is partially instantiated.. you can read the variables within
the instance.


So if I understand you it works this way:

On post an event in the new page is fired.

From this event I can access the variables from the last page.

But I have to read all the variables - ie it elimiates postback type
things
correct?

So its very simlilar to what we have now, you are just defining where to
go
before hand, and the event is fired on that page instead.

Is this correct?
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
ELKNews - Get your free copy at http://www.atozedsoftware.com

Nov 18 '05 #7
asp.net 2 must be cool :~)

The reason why I didn't want to use session is also that it expires
very soon on my system :=(
Nov 18 '05 #8

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

Similar topics

1
3891
by: WeAreGoing! | last post by:
Hello. I need to transfer an MD5 digest number between two pages on different domains. I know this is generally not possible, but I have full access on one domain and can insert Javascript at...
1
12951
by: TErnst | last post by:
Hello All.... What I am attempting to do is have a link/button on a page (testpopup.cfm) that opens a popup page (popupwindow.cfm). The popup page displays a resultset from a query and the...
23
12220
by: John | last post by:
Last year, I remember finding a web page describing how to pass the name of a file to another web page, and have that web page load that image file. Now, I can't find my record of that (it was...
7
21579
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
5
7801
by: Julien C. | last post by:
Hi all, I have an "EditeItem.aspx" page which lets me edit properties of an "Item". In the OnClick() event of my Save button, I do save Item changes to the database and then I redirect the user...
9
2303
by: Alan Silver | last post by:
Hello, I'm a bit surprised at the amount of boilerplate code required to do standard data access in .NET and was looking for a way to improve matters. In Classic ASP, I used to have a common...
2
3334
by: bbsbob | last post by:
Hello, I'm still using the Framework v1.1. Forgive me, I'm working on a legacy application. I'm using 2 iFrame sections with 2 aspx pages, i.e. 1.aspx (left) and 2.aspx (right) In 1.appx page,...
1
2950
by: googlegroup | last post by:
How do you pass a parameter into the master pages, much like the TITLE. I'd like to pass SectionID from the ChildPages to the MasterPage (which calculates information based on SectionID)
5
5903
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, Is there an easier way to handle that? I used Javascript to handle this when our two domains are hosted on two different servers(on different networks) and our search engine marketing...
0
7054
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7057
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7102
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
5357
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,...
1
4798
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...
0
4495
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3000
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1310
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
199
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.