Response.Redirect hates me

K

Kasey

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!
 
G

Gozirra

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.
 
K

Kasey

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!! =)
 
K

Kasey

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!! =)
 
G

Gozirra

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top