paging with jQuery
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="demo.aspx.cs" Inherits="demo" %>
<%@ Register src="header.ascx" tagname="header" tagprefix="uc1" %>
<%@ Register src="left.ascx" tagname="left" tagprefix="uc2" %>
<%@ Register src="script.ascx" tagname="script" tagprefix="uc3" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Collections" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Security" %>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Web.UI.HtmlControls" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajx" %>
<%@ Register src="footer.ascx" tagname="footer" tagprefix="uc4" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>online Shop</title>
<% string scid = Request.QueryString["id"];
if (id == "" || id == null)
{
Response.Redirect("default.aspx");
}
<link rel="stylesheet" href="style.css" type="text/css" />
<uc3:script ID="script1" runat="server" />
</head>
<body>
<form id="form1" runat="server">
<uc1:header ID="header1" runat="server" />
<table border="0" cellspacing="0" cellpadding="0" class="content">
<tr>
<td>
</td>
</tr>
<tr><td> </td> </tr>
<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<%
string scid = Request.QueryString["id"];
string curl = "";
DataUtility dut = new DataUtility();
string dsql = "select * from subcategory where catid='" + id + "'";
DataTable dtC = dut.getDataTable(dsql);
if (dtC.Rows.Count > 0)
{
//curl = dtC.Rows[0]["curl"].ToString();
}
if (id == "" || id == null)
{
Response.Redirect("default.aspx");
}
DataTable dt;
Utility ut = new Utility();
string sql;
int pagecount = 0;
int cpage = 0;
int totitem = 0;
int items = 12;
if (Request.QueryString["cpage"] == "" || Request.QueryString["cpage"] == null)
{
cpage = 1;
}
else
{
cpage = int.Parse(Request.QueryString["cpage"].ToString());
}
sql = "select * from category where catid='" + id + "'";
dt = dut.getDataTable(sql);
pagecount = int.Parse((Math.Ceiling(double.Parse(dt.Rows.Count.ToString()) / items).ToString()));
int startno = 0;
if (cpage == 1)
{
startno = 0;
}
else
{
startno = (cpage - 1) * items;
}
int pageitem = cpage * items;
totitem = dt.Rows.Count > pageitem ? pageitem : dt.Rows.Count;
%>
<tr valign="top">
<td width="25%">
<uc2:left ID="left1" runat="server" />
</td>
<td width="3%"> </td>
<td width="72%">
<h1>Products</h1>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="products">
<%
if (dt.Rows.Count>0)
{%>
<tr>
<td>
<div class="demo">
<div id="demo2">
</div>
</div>
</td>
</tr>
<tr>
<td>
<%for (int i = startno; i < totitem; i++)
{%>
<div class="product">
<div class="img"> <a href="demo-display.aspx?pid=<%=dt.Rows[i]["demoid"].ToString()%>"><img src="<%=dt.Rows[i]["Fpath"].ToString()%>" alt="" width="200" height="200" /></a> </div>
<div class="p-bottom">
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#000">
<tr>
<td width="70%">
<h2><%=dt.Rows[i]["demoname"].ToString() %></h2>
<% if (Convert.ToDouble(dt.Rows[i]["price"].ToString()) > Convert.ToDouble(dt.Rows[i]["saleprice"].ToString()))
{%>
<h3>Rs. <%=dt.Rows[i]["price"].ToString()%>/- <span>Rs. <%=dt.Rows[i]["saleprice"].ToString()%>/-</span></h3>
<strong> Save Rs. <%=(Convert.ToDouble(dt.Rows[i]["saleprice"].ToString()) - Convert.ToDouble(dt.Rows[i]["price"].ToString()))%>/- </strong>
<%}
else
{ %>
<h3>Rs. <%=dt.Rows[i]["price"].ToString()%>/- </h3>
<%} %>
</td>
<td width="30%" align="right"> <a href="add.aspx?id=<%=dt.Rows[i]["demoid"]%>"><img src="images/addcart.png" alt="" /></a> </td>
</tr>
</table>
</div>
</div>
<%}%>
</td>
</tr>
<tr>
<td>
<div class="demo">
<div id="demo3">
</div>
</div>
</td>
</tr>
<%}
else
{%>
<tr>
<td>
There is no product found in this category
</td>
</tr>
<%}%>
</table>
</td>
</tr>
</table>
</td></tr>
</table>
<uc4:footer ID="footer1" runat="server" />
<script type="text/javascript">
$(function() {
var page = "<%=cpage%>";
var totPages = "<%=pagecount%>";
var id = "<%=id%>";
var curl = "";
if (totPages > 0) {
$("#demo2").paginate({
count: parseInt(totPages),
start: parseInt(page),
display: 10,
border: true,
border_color: '#c5c5c5',
text_color: '#000',
background_color: '#fff',
border_hover_color: '#c5c5c5',
text_hover_color: '#000000',
background_hover_color: '#eeeeee',
rotate: true,
images: false,
mouse: 'press',
onChange: function(page) {
window.location = '/' + curl + '/' + id + '/' + page + '.html';
}
});
}
});
</script>
<script type="text/javascript">
$(function() {
var page = "<%=cpage%>";
var totPages = "<%=pagecount%>";
var scid = "<%=scid%>";
var curl = "";
if (totPages > 0) {
$("#demo3").paginate({
count: parseInt(totPages),
start: parseInt(page),
display: 10,
border: true,
border_color: '#c5c5c5',
text_color: '#000',
background_color: '#fff',
border_hover_color: '#c5c5c5',
text_hover_color: '#000000',
background_hover_color: '#eeeeee',
rotate: true,
images: false,
mouse: 'press',
onChange: function(page) {
window.location = '/' + curl + '/' + scid + '/' + page + '.html';
}
});
}
});
</script>
</form>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="demo.aspx.cs" Inherits="demo" %>
<%@ Register src="header.ascx" tagname="header" tagprefix="uc1" %>
<%@ Register src="left.ascx" tagname="left" tagprefix="uc2" %>
<%@ Register src="script.ascx" tagname="script" tagprefix="uc3" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Collections" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Security" %>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Web.UI.HtmlControls" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajx" %>
<%@ Register src="footer.ascx" tagname="footer" tagprefix="uc4" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>online Shop</title>
<% string scid = Request.QueryString["id"];
if (id == "" || id == null)
{
Response.Redirect("default.aspx");
}
<link rel="stylesheet" href="style.css" type="text/css" />
<uc3:script ID="script1" runat="server" />
</head>
<body>
<form id="form1" runat="server">
<uc1:header ID="header1" runat="server" />
<table border="0" cellspacing="0" cellpadding="0" class="content">
<tr>
<td>
</td>
</tr>
<tr><td> </td> </tr>
<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<%
string scid = Request.QueryString["id"];
string curl = "";
DataUtility dut = new DataUtility();
string dsql = "select * from subcategory where catid='" + id + "'";
DataTable dtC = dut.getDataTable(dsql);
if (dtC.Rows.Count > 0)
{
//curl = dtC.Rows[0]["curl"].ToString();
}
if (id == "" || id == null)
{
Response.Redirect("default.aspx");
}
DataTable dt;
Utility ut = new Utility();
string sql;
int pagecount = 0;
int cpage = 0;
int totitem = 0;
int items = 12;
if (Request.QueryString["cpage"] == "" || Request.QueryString["cpage"] == null)
{
cpage = 1;
}
else
{
cpage = int.Parse(Request.QueryString["cpage"].ToString());
}
sql = "select * from category where catid='" + id + "'";
dt = dut.getDataTable(sql);
pagecount = int.Parse((Math.Ceiling(double.Parse(dt.Rows.Count.ToString()) / items).ToString()));
int startno = 0;
if (cpage == 1)
{
startno = 0;
}
else
{
startno = (cpage - 1) * items;
}
int pageitem = cpage * items;
totitem = dt.Rows.Count > pageitem ? pageitem : dt.Rows.Count;
%>
<tr valign="top">
<td width="25%">
<uc2:left ID="left1" runat="server" />
</td>
<td width="3%"> </td>
<td width="72%">
<h1>Products</h1>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="products">
<%
if (dt.Rows.Count>0)
{%>
<tr>
<td>
<div class="demo">
<div id="demo2">
</div>
</div>
</td>
</tr>
<tr>
<td>
<%for (int i = startno; i < totitem; i++)
{%>
<div class="product">
<div class="img"> <a href="demo-display.aspx?pid=<%=dt.Rows[i]["demoid"].ToString()%>"><img src="<%=dt.Rows[i]["Fpath"].ToString()%>" alt="" width="200" height="200" /></a> </div>
<div class="p-bottom">
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#000">
<tr>
<td width="70%">
<h2><%=dt.Rows[i]["demoname"].ToString() %></h2>
<% if (Convert.ToDouble(dt.Rows[i]["price"].ToString()) > Convert.ToDouble(dt.Rows[i]["saleprice"].ToString()))
{%>
<h3>Rs. <%=dt.Rows[i]["price"].ToString()%>/- <span>Rs. <%=dt.Rows[i]["saleprice"].ToString()%>/-</span></h3>
<strong> Save Rs. <%=(Convert.ToDouble(dt.Rows[i]["saleprice"].ToString()) - Convert.ToDouble(dt.Rows[i]["price"].ToString()))%>/- </strong>
<%}
else
{ %>
<h3>Rs. <%=dt.Rows[i]["price"].ToString()%>/- </h3>
<%} %>
</td>
<td width="30%" align="right"> <a href="add.aspx?id=<%=dt.Rows[i]["demoid"]%>"><img src="images/addcart.png" alt="" /></a> </td>
</tr>
</table>
</div>
</div>
<%}%>
</td>
</tr>
<tr>
<td>
<div class="demo">
<div id="demo3">
</div>
</div>
</td>
</tr>
<%}
else
{%>
<tr>
<td>
There is no product found in this category
</td>
</tr>
<%}%>
</table>
</td>
</tr>
</table>
</td></tr>
</table>
<uc4:footer ID="footer1" runat="server" />
<script type="text/javascript">
$(function() {
var page = "<%=cpage%>";
var totPages = "<%=pagecount%>";
var id = "<%=id%>";
var curl = "";
if (totPages > 0) {
$("#demo2").paginate({
count: parseInt(totPages),
start: parseInt(page),
display: 10,
border: true,
border_color: '#c5c5c5',
text_color: '#000',
background_color: '#fff',
border_hover_color: '#c5c5c5',
text_hover_color: '#000000',
background_hover_color: '#eeeeee',
rotate: true,
images: false,
mouse: 'press',
onChange: function(page) {
window.location = '/' + curl + '/' + id + '/' + page + '.html';
}
});
}
});
</script>
<script type="text/javascript">
$(function() {
var page = "<%=cpage%>";
var totPages = "<%=pagecount%>";
var scid = "<%=scid%>";
var curl = "";
if (totPages > 0) {
$("#demo3").paginate({
count: parseInt(totPages),
start: parseInt(page),
display: 10,
border: true,
border_color: '#c5c5c5',
text_color: '#000',
background_color: '#fff',
border_hover_color: '#c5c5c5',
text_hover_color: '#000000',
background_hover_color: '#eeeeee',
rotate: true,
images: false,
mouse: 'press',
onChange: function(page) {
window.location = '/' + curl + '/' + scid + '/' + page + '.html';
}
});
}
});
</script>
</form>
</body>
</html>
No comments:
Post a Comment