Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting URL of the page and passing it to other page 5

Status
Not open for further replies.

zxcdf5je

Programmer
Apr 1, 2005
86
US
hi there,
I have this page which lists all the users name and they can be edited deleted and updated.The page which does that is 2.asp and the page which actually lists all the users is 1.asp.
when i delete a particular user by using 2.asp ,after delteing the users name it redirects me to the first page of 1.asp and i again have to go do 28th page to proceed ahead with other users..is there any way i could catch that page number /page and make the user return to the page from where they came from?

Hope u are understanding what i want..
help needed..pleaseeeee

-Smita

1.asp uses this code to catch url:
'-------------------------------
' list Navigation begin
'-------------------------------
bEof = rs.eof
if not(rs.EOF and iPage=1) then
if iPage = 1 then
%>
<font style="font-size: 10pt; color: #000000; font-weight: bold; font-family: Arial, Tahoma, Verdana, Helvetica">Previous</font>
<%
else
%>
<a href="<%=file_name%>?<%=form_params%><%=sSortParams%>Formlist_Page=<%=iPage - 1%>#list"><font style="font-size: 10pt; color: #000000; font-weight: bold; font-family: Arial, Tahoma, Verdana, Helvetica">Previous</font></a>
<%
end if
response.write "&nbsp;[&nbsp;" & iPage & "&nbsp;]&nbsp;"

if bEof then
%>
<font style="font-size: 10pt; color: #000000; font-weight: bold; font-family: Arial, Tahoma, Verdana, Helvetica">Next</font>
<%
else
%>
<a href="<%=file_name%>?<%=form_params%><%=sSortParams%>Formlist_Page=<%=iPage + 1%>#list"><font style="font-size: 10pt; color: #000000; font-weight: bold; font-family: Arial, Tahoma, Verdana, Helvetica">Next</font></a>
<%
end if
end if
'-------------------------------
' list Navigation end
'-------------------------------

2.asp
has just a variable sActionField="1.asp"
which if delete update pressed would point to this variable and take it to the first page ..

hope that helps
 
Let me make sure I am following you:

Page1.asp displays a paged recordset which currently has 28 pages because of the size of the database... it knows which page to load because it pulls the value out of the QueryString.

Each record displayed on Page1 has a link to Page2. Page2 reads the record key from the QueryString, processes the record, and then returns the user to Page1.

OK, if these assumptions are both correct, then the thing to do is to include the Page # in the HREF for each record on Page1.asp. Then you can read it out in Page2.asp the same way that you read the record key. You use it in your Redirect to send the user back to the appropriate "page" of Page1.asp

 
yes u are right in ur assumptions but can u tell me how i can include page# in HREF and read it in page2.asp and redirect it?
i am actually modifyin someones already written code and am very weak in asp..
please can u be descriptive

thanks so much for replying back
-Smita
 
OK, in the HTML page that has the links, look for the anchor tag that makes the actual links.

The QueryString is everything after the question mark "?" What you need to do is to add an item to the QueryString.

So, for example, if the anchor tag looks like this:
<a href="page2.asp?KeyValue=Tom123">Tom</a>

Then you want to change it to look like this:
<a href="page2.asp?KeyValue=Tom123&MyPage=X">Tom</a>
Where X is the current page. Notice the "&" character, you must have this between items in your QueryString.

Sometimes if you are having a hard time finding the right place in the code, you can use "View Source" on the page and work backwards from there.

Anyway, as to the changes to Page2.asp... search it to find the place where it is reading the Key value. It will look something like: Request("KeyValue") or perhpas Request.QueryString("KeyValue") where KeyValue is the record key used in the HREF property on Page1.asp. Anyway, you want to do the same thing for the new item that you added to the QueryString. In my example above I called it "MyPage." Once you have this value you simply append it to the Response.Redirect like this:
Response.Redirect "page1.asp?MyPage=???"
Or if there is something already in the redirected QueryString use the "&" symbol like this:
Response.Redirect "page1.asp?Somthing=blah&MyPage=X"
Where X is the page you want to go to.
 
the url i see for page1.asp is:
and for now its on page 2 which is shown in the link...

now if i select a item from this page to update i go to this link on 2.asp

now when i hit update/delte i shoudl go back to this link
which i have listed above)

does your above sultuion holds good for the above descriptive thing i havce mentioned...just want to chck if we both are on same page b4 i go ahead and do the modification with ur help...

Thanks so much for ur help..
-Smita
 
Also wht if i do this thing:
What if i include 1.php file in 2.php by
<%--include file=1.php%>
and then where the variable which was set to be pointed to go to 1.php i set something like this:
sActionField="<%=file_name%>?<%=form_params%><%=sSortParams%>Formlist_Page=iPage%>#list"

Do u think this would work?

-Smita
 
its password protected....:(
do u still wanna look at it?
 
you need to set page 1's link like this

<a href="2.asp?ID=6723&s_company=&Formlist_Page=2#list">Tom</a>

then on page 2 after the submit action do a

Response.Redirect "page1.asp?s_company="&request("s_company")&"&Formlist_Page="&request("Formlist_Page")
 
steven290, I think Smita is just giving examples to show the interpretation of the big glob of text that I wrote.

Wait, I'm confused, why are you talking about PHP files?

Anyway, ignoring the PHP and assuming that your first link is correct, then the second link should look like this:


And your 3rd link should look just like your first one.

To make the 3rd link just like the first you should get the value of Formlist_Page from the request object... use something like this:
Dim MyPage
MyPage = Request.QueryString("Formlist_Page")

or you could just do:
Dim MyPage
MyPage = Request("Formlist_Page")

Or you could just use it in line when you do the Redirect:
Response.Redirect "1.asp?s_company=" & Request("s_company") & "&Formlist_Page=" & Request("Formlist_Page")
 
makes it more clear..but not if you notice the ID=6723 part of this url:
<a href="2.asp?ID=6723&s_company=&Formlist_Page=2#list">Tom</a>

is a variable and is the id of the record on which i have clicked..it s not constant....will the above solution take care of this ?

Thanks a lot lot lot for helping me out..'
i feel better now and can try something for sure!!!

-Smita
 
do u guys know each other??steven and sheco!!!?
 
Oh you want to keep getting the ID part of the anchor HREF the same way you are doing now.

The only change you need to make on Page1.asp is to add the Formlist_Page after the ID.
 
just on the forum - sheco knows what he is doing thats what i like about him
 
Well it is obvious that you got some good advice when 2 people that don't know each other come up with exactly the same thing!

Compare this:
Response.Redirect "page1.asp?s_company="&request("s_company")&"&Formlist_Page="&request("Formlist_Page")

And this:
Response.Redirect "1.asp?s_company=" & Request("s_company") & "&Formlist_Page=" & Request("Formlist_Page")

 
yup all of u have been of reall reall great help to me..
i am trying ur solution now steven..stay there ...:)
 
Only difference is my typo error calling it 1.asp instead of page1.asp!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top