473,382 Members | 1,441 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,382 software developers and data experts.

Q: move between pages

Hello,
What is the best way to move from aspx page to aspx page by passing
variables. I was using session variables with Response.Redirectin both ways,
it may not be the right way. Users click a button in the current page and I
need pass a variable to use in the second page and when user click close I
need to jump back to first page. How can I do this? Can you give me exaple
please?
Thanks,
Jim.

Nov 19 '05 #1
7 1257
A QueryString works well:

<a href="Page2?SomeParam=5">Go to page 2</a>

and in Page2.aspx's Page_Load:

string val = Request.QueryString["SomeParam"];

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hello,
What is the best way to move from aspx page to aspx page by passing
variables. I was using session variables with Response.Redirectin both
ways,
it may not be the right way. Users click a button in the current page
and I
need pass a variable to use in the second page and when user click
close I
need to jump back to first page. How can I do this? Can you give me
exaple
please?
Thanks,
Jim.


Nov 19 '05 #2
What is the best way to move from aspx page to aspx page by passing
variables.


I use query strings. No idea if that's 'best' or not.

-Darrel
Nov 19 '05 #3
Oops, sloppy post -- Juan's gonna be all over me ;)
<a href="Page2?SomeParam=5">Go to page 2</a>


Should have been (note .aspx added):

<a href="Page2.aspx?SomeParam=5">Go to page 2</a>

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #4
Thanks for the reply. all these htlm confuses me. can I handle it code
behind? can you give me a site that has query string example.

"Brock Allen" wrote:
Oops, sloppy post -- Juan's gonna be all over me ;)
<a href="Page2?SomeParam=5">Go to page 2</a>


Should have been (note .aspx added):

<a href="Page2.aspx?SomeParam=5">Go to page 2</a>

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #5
Here's a nice, simple way to pass values from one page to another:
(VB.NET code)

'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")

Then, in WebForm2.aspx:

'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)

Of course there are a number of ways to pass values from one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page, etc.
You'll have to decide which technique is best for your application.
Here are several good articles on the subject to help you decide.
http://msdn.microsoft.com/msdnmag/is...e/default.aspx

http://www.aspalliance.com/kenc/passval.aspx

http://www.dotnetbips.com/displayarticle.aspx?id=79

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"JIM.H." <JI**@discussions.microsoft.com> wrote in message
news:30**********************************@microsof t.com...
Hello,
What is the best way to move from aspx page to aspx page by passing
variables. I was using session variables with Response.Redirectin both
ways,
it may not be the right way. Users click a button in the current page and
I
need pass a variable to use in the second page and when user click close I
need to jump back to first page. How can I do this? Can you give me exaple
please?
Thanks,
Jim.

Nov 19 '05 #6
Hello,
I have;
string strName = this.Context.Items["name"].ToString();
in page_load in WebForm2.aspx. It works fine when loading, I need to close
this page and return back to first page so I have a close button with
Response.Redirect("MyPage.aspx");
When I click I get “Object reference not set to an instance of an object.”
at tle line I mentioned above. What should I do?
Thanks,
Jim.
"Steve C. Orr [MVP, MCSD]" wrote:
Here's a nice, simple way to pass values from one page to another:
(VB.NET code)

'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")

Then, in WebForm2.aspx:

'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)

Of course there are a number of ways to pass values from one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page, etc.
You'll have to decide which technique is best for your application.
Here are several good articles on the subject to help you decide.
http://msdn.microsoft.com/msdnmag/is...e/default.aspx

http://www.aspalliance.com/kenc/passval.aspx

http://www.dotnetbips.com/displayarticle.aspx?id=79

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"JIM.H." <JI**@discussions.microsoft.com> wrote in message
news:30**********************************@microsof t.com...
Hello,
What is the best way to move from aspx page to aspx page by passing
variables. I was using session variables with Response.Redirectin both
ways,
it may not be the right way. Users click a button in the current page and
I
need pass a variable to use in the second page and when user click close I
need to jump back to first page. How can I do this? Can you give me exaple
please?
Thanks,
Jim.


Nov 19 '05 #7
Try ignoring the error or playing with the 2nd (endResponse) parameter as
documented here:
http://msdn.microsoft.com/library/de...recttopic2.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"JIM.H." <JI**@discussions.microsoft.com> wrote in message
news:03**********************************@microsof t.com...
Hello,
I have;
string strName = this.Context.Items["name"].ToString();
in page_load in WebForm2.aspx. It works fine when loading, I need to close
this page and return back to first page so I have a close button with
Response.Redirect("MyPage.aspx");
When I click I get "Object reference not set to an instance of an object."
at tle line I mentioned above. What should I do?
Thanks,
Jim.
"Steve C. Orr [MVP, MCSD]" wrote:
Here's a nice, simple way to pass values from one page to another:
(VB.NET code)

'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")

Then, in WebForm2.aspx:

'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)

Of course there are a number of ways to pass values from one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page,
etc.
You'll have to decide which technique is best for your application.
Here are several good articles on the subject to help you decide.
http://msdn.microsoft.com/msdnmag/is...e/default.aspx

http://www.aspalliance.com/kenc/passval.aspx

http://www.dotnetbips.com/displayarticle.aspx?id=79

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"JIM.H." <JI**@discussions.microsoft.com> wrote in message
news:30**********************************@microsof t.com...
> Hello,
> What is the best way to move from aspx page to aspx page by passing
> variables. I was using session variables with Response.Redirectin both
> ways,
> it may not be the right way. Users click a button in the current page
> and
> I
> need pass a variable to use in the second page and when user click
> close I
> need to jump back to first page. How can I do this? Can you give me
> exaple
> please?
> Thanks,
> Jim.
>


Nov 19 '05 #8

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

Similar topics

17
by: black tractor | last post by:
HI there.. l was just wondering, if l place a "table" in the "editable region" of my template, will the text, graphics placed inside the this "table" MOVE BY ITSELF?? l mean, recently l had a...
2
by: cfmx | last post by:
I'm needing to move a database from SQL 7 to SQL 2000. What is the best way to accomplish this and keep all tables, data, permissions, etc in place throughout the move. Should I use BCP,...
1
by: Harald Weiser | last post by:
Good morning everybody. I would like to know if it is possible to move the mousepointer to another location with Javascript? For example Mouse.jumpTo(x,y) THX Harry
5
by: Galina | last post by:
Hello I have an Access 2000 application. The form has got a tab with 3 pages. There are several text boxes and command buttons on one page. I need to move them to another page (to free form space...
4
by: Vincent Yang | last post by:
I'm using Access 2002. My database is in Access 2000 format. I'm designing a form to collect responses to a 40-item questionnaire. I can fit four list boxes on a screen, so I plan to have 11 tab...
4
by: David Hearn | last post by:
I am trying to build a few pages basically emulating a wizard that you might find in a Windows product. A few fields to fill out on one page, move to the next, then the next. Finally, at the end,...
3
by: Wayne Wengert | last post by:
I am rewriting some ASP pages to move them to ASP.NET (VB). The old pages had some include files such as one that had the subroutine to create a connection as well as the code that invoked that...
10
by: Robert | last post by:
I have an app that was originally 1.1, now migrated to 2.0 and have run into some sporadic viewstate errors...usually saying the viewstate is invalid, eventvalidation failed or mac error. My web...
8
by: Gianni Rondinini | last post by:
hi all, i'm here again. i couldn't find/understand this on w3c css2 recommendation and documentation, then here i ask. i decided to still use some tables in my pages for some forms. i played...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.