asp paging problem

Discussion in 'ASP General' started by wk6pack, Oct 31, 2003.

  1. wk6pack

    wk6pack Guest

    Hi,

    I have an asp page that I would like to do paging. The problem I'm running
    into is that the same page that prints to the output is also recieving data
    from the previous page for query parameters for the sql string.

    When I click on the next page, it queries itself and loses all the query
    parameter information from the parameter page and brings back all the
    records.

    How can I keep the parameter values from the query form and still advance to
    the next page?

    thanks,
    Will
    wk6pack, Oct 31, 2003
    #1
    1. Advertising

  2. wk6pack

    Ray at Guest

    Well, I guess that all depends on how your page is coded. Here are some
    paging examples.

    http://www.asp101.com/articles/recordsetpaging/index.asp
    http://www.intranetjournal.com/ix/msg/39939.html
    http://www.codeproject.com/asp/rspaging.asp
    http://www.aspfree.com/examples/1808,1/examples.aspx
    http://www.aspfaq.com/2120

    Ray at work

    "wk6pack" <> wrote in message
    news:%...
    > Hi,
    >
    > I have an asp page that I would like to do paging. The problem I'm

    running
    > into is that the same page that prints to the output is also recieving

    data
    > from the previous page for query parameters for the sql string.
    >
    > When I click on the next page, it queries itself and loses all the query
    > parameter information from the parameter page and brings back all the
    > records.
    >
    > How can I keep the parameter values from the query form and still advance

    to
    > the next page?
    >
    > thanks,
    > Will
    >
    >
    Ray at, Oct 31, 2003
    #2
    1. Advertising

  3. "wk6pack" <> wrote in message
    news:%...
    > Hi,
    >
    > I have an asp page that I would like to do paging. The problem I'm

    running
    > into is that the same page that prints to the output is also recieving

    data
    > from the previous page for query parameters for the sql string.
    >
    > When I click on the next page, it queries itself and loses all the query
    > parameter information from the parameter page and brings back all the
    > records.
    >
    > How can I keep the parameter values from the query form and still advance

    to
    > the next page?
    >
    > thanks,
    > Will
    >
    >

    In the "next" page, include all the form fields sent to it in the new form
    using "hidden" as the field type. They won't show up on the "next" page but
    will be added to it's form values. e.g.

    Page 1 :

    <form....>
    <input type="text" name="Page1Field1">
    </form>

    Page 1 on submit sends it's info to Page 2

    Page 2 :

    <form....>
    <input type="hidden" name="Page1Field1">
    <input type="text" name="Page2Field1">
    </form>

    Page 2 calls page 3

    Page 3 :

    response.write(request.form(Page1Field1))
    response.write(request.form(Page2Field1))

    Got it?

    Good luck. I spent ages and ages getting all this stuff down pat about
    passing form information around.
    Simon Wigzell, Nov 2, 2003
    #3
  4. wk6pack

    wk6pack Guest

    Hi Simon,

    It doesnt seem to be recognizing the hidden variables? When the form
    resubmits itself, the hidden variables are blank.

    Here's the code:

    <form name="queryform" method='post'>
    <%
    ' ADO constants used in this page
    Const adOpenForwardOnly = 0
    Const adLockReadOnly = 1
    Const adCmdTableDirect = &H0200
    Const adUseClient = 3

    If Len(Request("pagenum")) = 0 Then
    lqrystatus = request.form("DropDownStatus") 'incomplete
    lqrygrp = request.form("DropDownSort")
    lstartdate = request.form("startdate")
    lenddate = request.form("enddate")
    lplocation = request.form("DropDownLocation")
    lqryemp = request.form("DropDownGroup")
    'response.write(startdate & ", " & enddate & "," & qrygrp)
    Else
    lqrystatus = request.form("qrystatus") 'incomplete
    lqrygrp = request.form("qrygrp")
    lstartdate = request.form("startdate")
    lenddate = request.form("enddate")
    lplocation = request.form("plocation")
    lqryemp = request.form("qryemp")
    'response.write(startdate & ", " & enddate & "," & qrygrp)
    end if

    response.write ("<input type='hidden' name='qrystatus' value='" & lqrystatus
    & "'>")
    response.write ("<input type='hidden' name='qrygrp' value='" & lqrygrp &
    "'>")
    response.write ("<input type='hidden' name='startdate' value='" & lstartdate
    & "'>")
    response.write ("<input type='hidden' name='enddate' value='" & lenddate &
    "'>")
    response.write ("<input type='hidden' name='plocation' value='" & lplocation
    & "'>")
    response.write ("<input type='hidden' name='qryemp' value='" & lqryemp &
    "'>")

    response.write Len(Request("pagenum") & chr(13))
    response.write ("hello " & lqryemp & chr(13))



    sql and query building in here.....



    Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") &
    "?pagenum=1"">First Page</a>"

    Response.Write "&nbsp;|&nbsp;"

    If abspage = 1 Then
    Response.Write "<span style=""color:silver;"">Previous Page</span>"
    Else
    Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") &
    "?pagenum=" & abspage - 1 & """>Previous Page</a>"
    End If

    Response.Write "&nbsp;|&nbsp;"

    If abspage < pagecnt Then
    Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") &
    "?pagenum=" & abspage + 1 & """>Next Page</a>"
    Else
    Response.Write "<span style=""color:silver;"">Next Page</span>"
    End If
    Response.Write "&nbsp;|&nbsp;"

    if abspage = pagecnt then
    Response.Write "<span style=""color:silver;"">Next Page</span>"
    Else
    Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") &
    "?pagenum=" & pagecnt & """>Last Page</a>"
    end if
    Response.Write "</div>" & vbcrlf


    thanks,
    Will

    "Simon Wigzell" <> wrote in message
    news:gu_ob.254159$9l5.111344@pd7tw2no...
    >
    > "wk6pack" <> wrote in message
    > news:%...
    > > Hi,
    > >
    > > I have an asp page that I would like to do paging. The problem I'm

    > running
    > > into is that the same page that prints to the output is also recieving

    > data
    > > from the previous page for query parameters for the sql string.
    > >
    > > When I click on the next page, it queries itself and loses all the query
    > > parameter information from the parameter page and brings back all the
    > > records.
    > >
    > > How can I keep the parameter values from the query form and still

    advance
    > to
    > > the next page?
    > >
    > > thanks,
    > > Will
    > >
    > >

    > In the "next" page, include all the form fields sent to it in the new form
    > using "hidden" as the field type. They won't show up on the "next" page

    but
    > will be added to it's form values. e.g.
    >
    > Page 1 :
    >
    > <form....>
    > <input type="text" name="Page1Field1">
    > </form>
    >
    > Page 1 on submit sends it's info to Page 2
    >
    > Page 2 :
    >
    > <form....>
    > <input type="hidden" name="Page1Field1">
    > <input type="text" name="Page2Field1">
    > </form>
    >
    > Page 2 calls page 3
    >
    > Page 3 :
    >
    > response.write(request.form(Page1Field1))
    > response.write(request.form(Page2Field1))
    >
    > Got it?
    >
    > Good luck. I spent ages and ages getting all this stuff down pat about
    > passing form information around.
    >
    >
    wk6pack, Nov 3, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UGF0cmljay5PLklnZQ==?=

    DataSet paging vs Datareader paging

    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Oct 8, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    10,651
    Scott Allen
    Oct 8, 2004
  2. wh1974
    Replies:
    0
    Views:
    2,415
    wh1974
    Jan 12, 2005
  3. Red
    Replies:
    1
    Views:
    702
  4. =?Utf-8?B?YW1qYWQ=?=

    DataGrid paging problem with asp.net urgent help

    =?Utf-8?B?YW1qYWQ=?=, Jul 28, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    384
    =?Utf-8?B?YW1qYWQ=?=
    Jul 28, 2006
  5. Geoerge Zolla

    ASP.Net Datagrid paging problem

    Geoerge Zolla, Dec 5, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    102
    George Zolla
    Dec 6, 2003
Loading...

Share This Page