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

Response.Redirect hates me

Problem:
------------------------
I have a list of names that spill over onto other pages. The user can
click on the pages to advance and see more names. The user can click on
a name to edit information. So, if I edit a name on page 5 and click
Submit, it redirects me to page 1 of the names. I want it to redirect
me back to the previous page.
All of the pages (1-10) are shown as
http://localhost/blah/query_users.aspx
When I hover my mouse over the numbers on the page, it says:
javascript: _doPostBack('results$_ctl54$_ctl#',")
Note - # being the page number I'm pointing at

Code behind button....
-----------------------------------------
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click

Select Case action
Case "ADD"
AddUser()
Case "UPDATE"
UpdateInsertUser()
End Select
If err Then Exit Sub
DConn.Close()
Response.Redirect("query_users.aspx")
End Sub

Any ideas? Do you need more information? Reply here only, please!

Oct 4 '06 #1
4 1469
You should be able to cast the sender to a button and then pull its
text/id info whatever you can use to determine the page number that you
are currently on.

Then you can pass this information along in querystring, session,
httpcontext, whatever you like to tell the page where it should begin.
As it stands, the redirect is like going to the page for the very first
time so you start at the beginning.

Just out of curiousity, why do you need to redirect back to the current
page? Can't you simply refresh the data you are displaying?

Hope this is helpful.

Oct 4 '06 #2
Hey there! Thanks for your response. That gives me a bit of insight.

Currently there is a huge list of usernames. 50 usernames are displayed
per page, the operator can jump from page to page using numbered links
at the bottom of each page. The operator can also click on each
username to view/edit information. When they leave the edit page, I
want them to go back to the exact page they were on, not all the way
back to the beginning of the list (unless I can be convinced that's a
GOOD thing).

So, if I click on MThompson to edit his info and he's displayed on page
50, when I click, "save," I don't want to be redirected to page 1...I
want to go back to page 50.

Hope that makes sense...thanks again for your help!! =)

Gozirra wrote:
You should be able to cast the sender to a button and then pull its
text/id info whatever you can use to determine the page number that you
are currently on.

Then you can pass this information along in querystring, session,
httpcontext, whatever you like to tell the page where it should begin.
As it stands, the redirect is like going to the page for the very first
time so you start at the beginning.

Just out of curiousity, why do you need to redirect back to the current
page? Can't you simply refresh the data you are displaying?

Hope this is helpful.
Oct 6 '06 #3
Hey there! Thanks for your response. That gives me a bit of insight.

Currently there is a huge list of usernames. 50 usernames are displayed
per page, the operator can jump from page to page using numbered links
at the bottom of each page. The operator can also click on each
username to view/edit information. When they leave the edit page, I
want them to go back to the exact page they were on, not all the way
back to the beginning of the list (unless I can be convinced that's a
GOOD thing).

So, if I click on MThompson to edit his info and he's displayed on page
50, when I click, "save," I don't want to be redirected to page 1...I
want to go back to page 50.

Hope that makes sense...thanks again for your help!! =)

Gozirra wrote:
You should be able to cast the sender to a button and then pull its
text/id info whatever you can use to determine the page number that you
are currently on.

Then you can pass this information along in querystring, session,
httpcontext, whatever you like to tell the page where it should begin.
As it stands, the redirect is like going to the page for the very first
time so you start at the beginning.

Just out of curiousity, why do you need to redirect back to the current
page? Can't you simply refresh the data you are displaying?

Hope this is helpful.
Oct 6 '06 #4
Here's my suggestion. Fairly simple. Store the current page in
session. When you are finished editing and you return back to the list
page, pull the page number from session and retrieve the appropriate
data.

The possible problems I see are that you need to manage this
information in session. That way, when a user goes to the list page
expecting page 1, they don't end up on page 50 instead. Since I don't
know how navigation is set up and the overall construction of your
site, I leave that to you. Possible ideas are simply to clear this
session information when you know you no longer need it (when clicking
on menu links for example) or maybe even using a query string to
indicate that the session information is relevant.

Oct 6 '06 #5

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

Similar topics

3
by: Paul | last post by:
I'm not getting the results I want when I use Response.Redirct in a ASP page. I enter this line of code in a asp page from domain1.com. Response.Redirect...
4
by: JC | last post by:
Hi, I have a simple question regarding the Response.Redirect method. Does the server stop processing the ASP code as soon as it encounters the Redirect command? Or does it ever continue to...
4
by: TomT | last post by:
Hi.. I'm redirecting users to another page using: response.redirect("newpage.asp") this works... But I need to add a variable to the page specified.. IE: newpage.asp?id=JobID
6
by: Sam | last post by:
I have some issues with HTTP Headers and I was hoping for some pointers or references to good articles. Here is the problem. I have 6 .aspx pages, each page contains a common .ascx. This ascx...
3
by: Sehboo | last post by:
On my ASP page, when I click a button, I want to do three things: 1. Check for some values. 2. Open a new window and pass some values as query string. 3. Redirect to some other page Here...
13
by: Tim | last post by:
Hello, Is there a way to "cancel" a response.Redirect? For example, in the code below, could I insert anything in the Catch statement that would cancel the redirect and resume flow after the...
5
by: venner | last post by:
I'm having an issue with an ASP.NET website after upgrading to ASP.NET 2.0. The website makes use of a central authentication service (CAS) provided at the university I work for. Each page checks...
4
by: mike.biang | last post by:
I have an ASP page that is using an XMLHTTP object to request various pages from my server. I keep a single session throughout the XMLHTTP requests by bassing the ASPSESSIONID cookie through the...
9
by: RN1 | last post by:
When a server encounters the line Response.Redirect("abcd.asp") in a ASP script, the server tells the browser that it has to be redirected to another page (which is abcd.asp, in this case)....
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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: 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
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
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...

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.