Filtering and Paging with ASP Classic problems.

Filtering and Paging with ASP Classic problems.

zokanzizokanzi Posts: 9Questions: 2Answers: 0
edited October 2015 in Free community support

I've started to work out a server side script. My some problems solved this link. But my datatable does not work correctly. Maybe my problem is simple but I didn't solve this.

My last script codes:

$(document).ready(function() {
    $('#example').DataTable( {
        processing: true,
        serverSide: true,
        "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "Hepsi"]],
        pagination:true,
        "sPaginationType": "full_numbers",
        ajax: "musteri_list_load.asp"
   } );
 } );

And my musteri_list_load.asp codes:

<%
sEcho = Cint(Request("sEcho")) iDisplayLength = Cint(Request("iDisplayLength")) iDisplayStart = Cint(Request("iDisplayStart"))
sSearch=request.QueryString("sSearch")
%>
<% 
set rs1=Server.CreateObject("ADODB.recordset")
rs1.Open "Select * from ajax", bag,1,3
iTotalRecords = rs1.RecordCount

set rs=Server.CreateObject("ADODB.recordset")
rs.Open "Select * from ajax WHERE engine like '%"  & sSearch & "%'  ORDER BY id ASC", bag,1,3
iTotalDisplayRecords = rs.RecordCount

    
output = "{""draw"": 1, ""recordsTotal"": "& iTotalRecords  &", ""recordsFiltered"": "& iTotalDisplayRecords &", ""data"":["
    i = 0

    if rs.eof = false then
 
        rs.move(iDisplayStart)
     
        do while i < iDisplayLength and not rs.eof

output = output & "[" & """"& rs("ID") & """,""" & rs("engine") & """],"

            rs.movenext
 
            i=i+1
 
        loop
        'here we eliminate the last comma in the aaData output=Left(output,Len(output)-1)
output = output & "]}"
End If

response.write output

I don't know how to pass iDisplayLength, iDisplayStart and sSearch parameters to my asp page.

If I change iDisplayLength and iDisplayStart value to integer in my asp page, my datatable's first page is works. But pagination and filter are not working. It show "Processing..." text and it does not anything.

If it like the above, it shows error code. I don't know where the errors. Please help me. Thanks...

This discussion has been closed.