473,804 Members | 2,225 Online
Bytes | Software Development & Data Engineering Community
+ 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.Append Header("recordI D","123");
Response.Redire ct("page2.aspx" );

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

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

Response.Cache. SetCacheability (HttpCacheabili ty.NoCache), 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 2215
ee****@list.ru (Spongebob) wrote in
news:c3******** *************** **@posting.goog le.com:
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.Append Header("recordI D","123");
Response.Redire ct("page2.aspx" );


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

--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g 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.goog le.com:
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.Append Header("recordI D","123");
Response.Redire ct("page2.aspx" );


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

--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g 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******** ******@TK2MSFTN GP12.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/
"Programmin g 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******** ******@TK2MSFTN GP12.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/
"Programmin g 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******** ******@tk2msftn gp13.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/
"Programmin g 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.redire ct. 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******** ******@tk2msftn gp13.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/
"Programmin g 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
3914
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 will into tha pages of the other. I'd like to be able to store the number into a cookie for retrieval by either set of pages. I've been racking my brains for a couple of days on this one and just can't come up with the answer. Thanks in...
1
13018
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 selected record needs to be passed through a query string/URL parameter to the original calling page and will be available in the body onload event of the calling page. I open the popup window and display the query results, I then click on
23
12296
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 saved on another computer that I can't get to right now), and I can't remember what search parameters I used to find it when I googled the topic. Can anyone point me the right direction? I'd like to use a method that would be accessible to the...
7
21643
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 server ? Is it possible to use parameters in pass-through queries ? An additional question: Is it possible to connect to a database on MySQL or PostgreSQL using ADO ? Is it possible to execute pass-through queries with parameters, using ADO...
5
7835
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 to the Item page "ViewItem.aspx" with a simple : Server.Transfer("ViewItem.aspx"); I'd like to pass another HTTP parameter so that in the "ViewItem.aspx" page,
9
2320
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 function that was included in all pages that took an SQL query and returned a disconnected recordset. This meant that data access could be achieved in a single line. I would like to do something similar in ASP.NET. I know I could just duplicate...
2
3356
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, I have a treeview control, I'd like to pass a selected node string to 2.aspx page and then to display some contents with passed node string. How could I accomplish that? The task is to pass the string parameter and
1
2964
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
5921
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 people don't like the javascript links since they think the links are not favorable to a search robot. Now our company is thinking about hosting these two domians on the same server, So I am wodering if there is any easy way to do that. Would you...
0
9715
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10600
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10352
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9175
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7642
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6867
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3835
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3002
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.