asp conditional intpage

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fran7
    New Member
    • Jul 2006
    • 229

    asp conditional intpage

    Hi, Anyone know if you can have a conditional intpage count.

    I have a page with a category1D.
    On that page I have a button for the visitor to diplay the results on the fly sort=asc.

    Thing is the form action is set to only the non sorted results. What I need is that if the visitor has sorted the results that they are passed to the next pages as sorted and when not that they arnt.
    Think I need a if clause but not sure, something like

    Code:
    		            <%
    If rsCard("lngCategoryID")="<%=lngCategoryID%>&sort=ASC" Then
    %>
    
    		
    <form action="directorym.asp?CategoryID=<%=lngCategoryID%>&sort=ASC" method="post">
    <%
    Else
    %>
    <form action="directorym.asp?CategoryID=<%=lngCategoryID%>" method="post">
    <%
    End If
    %>

    This is what I have


    Code:
    href="/directorym.asp?CategoryID=<%=lngCategoryID%>&sort=ASC"
    Code:
    <%If intpagecount > 1 Then %>
    
    <form action="directorym.asp?CategoryID=<%=lngCategoryID%>" method="post">
    Any help would be greatly appreciated.
    Thanks
    Richard
    Last edited by fran7; Oct 24 '07, 09:37 PM. Reason: forgot the title
  • Ranjan kumar Barik
    New Member
    • Aug 2007
    • 95

    #2
    Originally posted by fran7
    Hi, Anyone know if you can have a conditional intpage count.

    I have a page with a category1D.
    On that page I have a button for the visitor to diplay the results on the fly sort=asc.

    Thing is the form action is set to only the non sorted results. What I need is that if the visitor has sorted the results that they are passed to the next pages as sorted and when not that they arnt.
    Think I need a if clause but not sure, something like

    Code:
    		            <%
    If rsCard("lngCategoryID")="<%=lngCategoryID%>&sort=ASC" Then
    %>
    
    		
    <form action="directorym.asp?CategoryID=<%=lngCategoryID%>&sort=ASC" method="post">
    <%
    Else
    %>
    <form action="directorym.asp?CategoryID=<%=lngCategoryID%>" method="post">
    <%
    End If
    %>

    This is what I have


    Code:
    href="/directorym.asp?CategoryID=<%=lngCategoryID%>&sort=ASC"
    Code:
    <%If intpagecount > 1 Then %>
    
    <form action="directorym.asp?CategoryID=<%=lngCategoryID%>" method="post">
    Any help would be greatly appreciated.
    Thanks
    Richard
    Hi , Fran
    You have an error in your code in th second line.
    You are using asp tags inside asp tags.

    Here is the error;
    Code:
    		            <%
    If rsCard("lngCategoryID")="<%=lngCategoryID%>&sort=ASC" Then
    %>
    Ok, you are passing the variables using QueryString, then you can check it out in the next page that if you have got 'sort=asc' or not and using if...else condition you can sort or non sort.
    Let me know if something is wrong.

    Thanks

    Comment

    • fran7
      New Member
      • Jul 2006
      • 229

      #3
      Dear Ranjan, Thanks for the help. I see what you are saying and the error as I had written the possible if statement.
      The trouble is that the next page is the same page, and the moment you press next page the results are sent either
      with the sort=asc or without it depending on the form action. If that makes sense.
      There are basically two possibilities on the page for the results, either with the asc or without, but only one way
      of sending them to the next page. I see what you are saying about the querystring, but the form action predetermines the
      way they are sorted and sent, it seems. Any ideas or am I confussed?
      Thanks for your help.
      Richard

      Comment

      • Ranjan kumar Barik
        New Member
        • Aug 2007
        • 95

        #4
        Originally posted by fran7
        Dear Ranjan, Thanks for the help. I see what you are saying and the error as I had written the possible if statement.
        The trouble is that the next page is the same page, and the moment you press next page the results are sent either
        with the sort=asc or without it depending on the form action. If that makes sense.
        There are basically two possibilities on the page for the results, either with the asc or without, but only one way
        of sending them to the next page. I see what you are saying about the querystring, but the form action predetermines the
        way they are sorted and sent, it seems. Any ideas or am I confussed?
        Thanks for your help.
        Richard
        Hi , Fran
        If I am not wrong the default page is non sorted result and when user clicks the sort button it will sort the result as per your code. If that is fine, Then
        When the sort button is clicked you submit that page to the same page with "sort=asc" in the query string.
        Now you can write the code as;
        Code:
        strOpt = Response.QueryString("sort")
        If strOpt = "asc" Then
        	Code for sorting......
        Else
        	Code for not sorting......
        End If
        And write code for Not button to simply send user to the default page that is your not sorted result page.
        You can do this with the on click event of the Not button like;
        Code:
        onclick="javascript:self.location='page url'"
        Good day

        Comment

        • fran7
          New Member
          • Jul 2006
          • 229

          #5
          Dear Ranjan, Thanks, thats right, thats the solution. Thanks for your time. Worked a treat.
          All the best.
          richard

          Comment

          • Ranjan kumar Barik
            New Member
            • Aug 2007
            • 95

            #6
            Originally posted by fran7
            Dear Ranjan, Thanks, thats right, thats the solution. Thanks for your time. Worked a treat.
            All the best.
            richard
            You are most welcome.
            Have a good day.

            Comment

            Working...