im getting the page load..but my records are repeated after 10 content images.im getting the images properly loaded..but the labels are not working properly..the contentplaceholder goes to 1st position on load
sir when im scrolling the page...it is loading but the contenplaceholder moves to the id=0 after load...and i want it to become id=11
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="11.aspx.cs" Inherits="_11" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<div>
<div id="dvImages" style="height: 250px; overflow: auto; width: 517px">
<asp:Repeater ID="rptImages" runat="server">
<ItemTemplate>
<div class="scrolling-box">
<div class="scroll">
<div class="col-md-5 col-xs-12 zoom" shadow style="height: 400px; background-color: white;">
<div class="row">
<div class="col-md-12 col-xs-12" style="display: inline;">
<div class="aspect-ratio-box" style="height: 500px; background-color: white">
<div class="aspect-ratio-box-inside" style="height: 233px; background-color: black; width: 107%;">
<div class="imgselltruck">
<asp:Image ID="Image1" runat="server" ImageUrl='<%#Eval("Imgt1") %>' CssClass="findp imgselltruck" />
<div class="gap"></div>
<div class="row" style="padding-top: 20px; padding-left: 15px; margin-top: -8px; margin-left: 20px">
<div class="col-md-6 col-xs-7" style="margin: -3px">
<h3>
<asp:Label ID="lblvname" runat="server" Text='<%#Eval("T_Model") %>'><br />
</asp:Label></h3>
</div>
<div class="col-md-6 col-xs-5 pull-right" style="margin: -3px">
<h3><b>
<span class=" icon k-icon" />₹
<asp:Label ID="lblvprice" runat="server" Text='<%#Eval("T_Sellprice") %>' CssClass="grey">
</asp:Label>
<asp:Label ID="lblslash" runat="server" Text="Lakhs"></asp:Label></b></h3>
</div>
</div>
<div class="row">
<div class="col-md-12 col-xs-12 " style="height: 50px; margin-top: -13px; margin-left: 20px">
<div class="PageDescpd0" style="margin-top: -4px; padding-left: 11px;">
<p>
<asp:Label ID="lblkmd" runat="server" Text='<%#Eval("T_Kmd") %>'></asp:Label>
|
<asp:Label ID="lblfuel" runat="server" Text='<%#Eval("T_Fueltype") %>'></asp:Label>
|
<asp:Label ID="lbldate" runat="server" Text='<%#Eval("P_Date") %>'></asp:Label>
</p>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12 col-xs-12" style="height: 50px; margin-top: 25px;">
<div class="PageDescpd0" style="margin-top: -60px; padding-left: 12px">
<p>
<asp:Label ID="lblownercity" runat="server" Text='<%#Eval("T_OwnerCity") %>' Style="color: #040202;"></asp:Label>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br />
</ItemTemplate>
</asp:Repeater>
</div>
</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
var pageIndex = 1;
var pageCount = 10;
var IsNoMoreImages = false;
$("#dvImages").on("scroll", function (e) {
var $o = $(e.currentTarget);
if ($o[0].scrollHeight - $o.scrollTop() <= $o.outerHeight()) {
GetRecords();
}
});
function GetRecords() {
pageIndex++;
if (pageIndex == 2 || pageIndex <= pageCount) {
if ($(".loader").is(':visible') == 0) {
$(".loader").show();
}
$.ajax({
type: "POST",
url: "11.aspx/GetImages",
data: '{pageIndex: ' + pageIndex + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert(response.d);
},
error: function (response) {
alert(response.d);
}
});
} else {
if (!IsNoMoreImages) {
IsNoMoreImages = true;
$("#dvImages").append('<br /><div><b>No more images to show...</b><div>');
}
}
}
function OnSuccess(response) {
var xmlDoc = $.parseXML(response.d);
var xml = $(xmlDoc);
pageCount = parseInt(xml.find("PageCount").eq(0).find("PageCount").text());
var customers = xml.find("tbl_Truck");
var table = $("tbl_Truck div").eq(0).clone(true);
$("#dvImages div").eq(0).remove();
customers.each(function () {
var customer = $(this);
$(".lblvname", table).attr('href', customer.find("T_Model").text());
$(".lblvprice", table).attr('href', customer.find("T_Sellprice").text());
$(".lblkmd", table).attr('href', customer.find("T_Kmd").text());
$(".lblfuel", table).attr('href', customer.find("T_Fueltype").text());
$(".lbldate", table).attr('href', customer.find("P_Date").text());
$(".lblownercity", table).attr('href', customer.find("T_OwnerCity").text());
$(".btngetcontact", table).attr('href', customer.find("ST_id").text());
$(".imgselltruck", table).attr('href', customer.find("Imgt1").text());
$(".imgselltruck", table).find('img').attr('src', customer.find("Imgt1").text());
$("#dvImages").append(table);
table = $("#dvImages div").eq(0).clone(true);
});
$(".loader").hide();
}
</script>
</div>
</form>
</body>
</html>
public partial class BuyTruck : BasePage
{
WebSellTruck objst = new WebSellTruck();
Truckbhada tb = new Truckbhada();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
RepSellTruck.DataSource = GetStruckData(1);
RepSellTruck.DataBind();
}
}
[WebMethod]
public static string GetStruck(int pageIndex)
{
System.Threading.Thread.Sleep(1000);
return GetStruckData(pageIndex).GetXml();
}
public static DataSet GetStruckData(int pageIndex)
{
string query = "[spGetStruck]";
SqlCommand cmd = new SqlCommand(query);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@PageIndex", pageIndex);
cmd.Parameters.AddWithValue("@PageSize", 10);
cmd.Parameters.Add("@PageCount", SqlDbType.Int, 4).Direction = ParameterDirection.Output;
return GetStruck(cmd);
}
private static DataSet GetStruck(SqlCommand cmd)
{
string cs = @"Data Source=DESKTOP-QJVUM5G\SQLEXPRESS;Initial Catalog=truckbhada;Integrated Security=True";
using (SqlConnection con = new SqlConnection(cs))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.Connection = con;
sda.SelectCommand = cmd;
using (DataSet ds = new DataSet())
{
sda.Fill(ds, "tbl_BuySellTruck");
DataTable dt = new DataTable("PageCount");
dt.Columns.Add("PageCount");
dt.Rows.Add();
dt.Rows[0][0] = cmd.Parameters["@PageCount"].Value;
ds.Tables.Add(dt);
return ds;
}
}
}
}
}