By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,660 Members | 1,593 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,660 IT Pros & Developers. It's quick & easy.

how to code for paging using server side java script with classic asp

P: 2
Expand|Select|Wrap|Line Numbers
  1. <% @Language="JavaScript" %>
  2. <html>
  3. <head><title> User Register Details</title>
  4. <script language="JavaScript" type="text/JavaScript">
  5.  
  6. function load()
  7. {
  8. var co =document.getElementById('coname');
  9. var so=document.getElementById('sorder');
  10. var cur=document.getElementById('curpage');
  11. var dir=document.getElementById('direction');
  12. var wsql=document.getElementById('whsql');
  13. co.value="";
  14. so.value="Asc";
  15. cur.value=1;
  16. dir.value="";
  17. wsql.value=""
  18. }
  19. function next()
  20. {
  21.  
  22. var co =document.getElementById('coname');
  23.  
  24. var so=document.getElementById('sorder');
  25. var cur=document.getElementById('curpage');
  26. var dir=document.getElementById('direction');
  27. var wsql=document.getElementById('whsql');
  28. co.value="FirstName";
  29. so.value="Asc";
  30. cur.value=1;
  31. dir.value="Next";
  32. wsql.value=""
  33.  
  34. }
  35.  
  36.  
  37.  
  38. </script>
  39. </head>
  40. <body>
  41. <div>
  42.  
  43. <form action="demo.asp" onload="javascript:load();" method ="Post" >
  44.  
  45. <input type="hidden"  id= "coname" name="colname" value= " " Size="20" maxlength="10" runat="server" />
  46. <input type="hidden"  id= "sorder" name="sorder" value= " " Size="20" maxlength="10" runat="server" />
  47. <input type="hidden"  id= "curpage" name="curpage" value= " " Size="20" maxlength="10" runat="server" />
  48. <input type="hidden"  id= "direction" name="direction" value= " " Size="20" maxlength="10" runat="server"  />
  49. <input type="hidden"  id= "whsql" name="whsql" value= " " Size="20" maxlength="10" runat="server"  />
  50.  
  51. <input type="image" id="First" name="First"  src="First1.gif" runat="server" />
  52. <input type="image" id="Previous" name="Previous"  src="previous1.gif" runat="server" />
  53. <input type="image" id="next" name="next" src="next1.gif" onclick="javascript:next();" runat="server" />
  54. <input type="image" id="Last" name="Last"  src="Last1.gif" runat="server" />
  55.  
  56. <%
  57.  
  58. var Connection = new ActiveXObject("ADODB.Connection");
  59. var Recordset = new ActiveXObject("ADODB.Recordset");
  60. var Ls_SQL;
  61. var  NumPerPage = 4;
  62.  
  63.  
  64.  
  65.  
  66. var strConn ="DSN=a;UID=sa;PWD=SageCRM72;Database=RegisterDB";
  67. Connection.Open(strConn);
  68. Ls_SQL = "SELECT FirstName,LastName,UserName,Password,EmailId,PhoneNo,Address1,Address2,Country,State,City FROM Register order by FirstName asc"
  69. Recordset.Open(Ls_SQL,Connection);
  70.  
  71. %>
  72.  
  73. <table width=100% align=center border=1>
  74. <tr>
  75. <td align=center><a href="demo.asp">FirstName</a></td>
  76. <td align=center><a href="demo.asp">LastName</a></td>
  77. <td align=center><a href="demo.asp">UserName</a></td>
  78. <td align=center><a href="demo.asp">Password</a></td>
  79. <td align=center><a href="demo.asp">EmailId</a></td>
  80. <td align=center><a href="demo.asp">PhoneNo</a></td>
  81. <td align=center><a href="demo.asp">Address1</a></td>
  82. <td align=center><a href="demo.asp">Address2</a></td>
  83. <td align=center><a href="demo.asp">Country</a></td>
  84. <td align=center><a href="demo.asp">State</a></td>
  85. <td align=center><a href="demo.asp">City</a></td>
  86. </tr>
  87.  
  88. <tr>
  89. <%while(!Recordset.EOF)
  90. %>
  91.  
  92. <td>
  93. <%
  94. Response.Write(Recordset.Fields("FirstName")); 
  95.  
  96. %>
  97. </td> 
  98. <td>
  99. <%
  100. Response.Write(Recordset.Fields("LastName")); %>
  101. </td>
  102. <td>
  103. <%Response.Write(Recordset.Fields("UserName")); %>
  104. </td>
  105. <td>
  106. <%
  107. Response.Write(Recordset.Fields("Password")); %>
  108. </td>
  109. <td>
  110. <%Response.Write(Recordset.Fields("EmailId")); %>
  111. </td>
  112. <td>
  113. <%Response.Write(Recordset.Fields("PhoneNo")); %>
  114. </td>
  115. <td>
  116. <%Response.Write(Recordset.Fields("Address1")); %>
  117. </td>
  118. <td>
  119. <%Response.Write(Recordset.Fields("Address2")); %>
  120. </td>
  121. <td>
  122. <%Response.Write(Recordset.Fields("Country")); %>
  123. </td>
  124. <td>
  125. <%Response.Write(Recordset.Fields("State")); %>
  126. </td>
  127. <td>
  128. <%Response.Write(Recordset.Fields("City")); %>
  129. </td></tr> 
  130. <%
  131. Recordset.MoveNext ;
  132. }
  133. %>
  134.  
  135. <%
  136. Recordset.Close();
  137. Connection.Close();
  138.  
  139. %>
  140.  
  141. </table>
  142. </form>
  143. </div>
  144. </body>
  145. </html>
  146.  
  147.  
  148.  
  149.  
  150.  
Jan 22 '14 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.