Click here to Skip to main content
15,889,096 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
the data will be loaded on scroll down event but it is not append to the datalist
plz help me.

my code is
<script type="text/javascript">
var pageIndex = 1;
var pageCount;
$(window).scroll(function () {
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
GetRecords();
}
});
function GetRecords() {
pageIndex++;
if (pageIndex == 2 || pageIndex <= pageCount) {
$("#loader").show();
$.ajax({
type: "POST",
url: "Collapsepage.aspx/GetCustomers",
data: '{pageIndex: ' + pageIndex + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert("failure"+response.d);
},
error: function (response) {
alert(response.d);
}
});
}
}
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("Customers");
customers.each(function () {
var customer = $(this);
var table = $("#dlistcmplist table").eq(0).clone(true);
$(".CName", table).html(customer.find("CName").text());
$(".BID", table).html(customer.find("BID").text());
$(".STD", table).html(customer.find("STD").text());
$(".SLName", table).html(customer.find("SLName").text());
$(".LName", table).html(customer.find("LName").text());
$(".CGName", table).html(customer.find("CGName").text());
$(".CLogo", table).html(customer.find("CLogo").text());
$(".B_Addr", table).html(customer.find("B_Addr").text());
$(".BrdNo", table).html(customer.find("BrdNo").text());
$(".MbleNo", table).html(customer.find("MbleNo").text());
$(".TFN", table).html(customer.find("TFN").text());
$(".rate", table).html(customer.find("rate").text());
$(".StCount", table).html(customer.find("StCount").text());
$(".Other", table).html(customer.find("Other").text());
$(".PageIndex", table).html(customer.find("PageIndex").text());
$(".PageText", table).html(customer.find("PageText").text());
$(".CCount", table).html(customer.find("CCount").text());
$(".CGID", table).html(customer.find("CGID").text());
$(".SMSNO", table).html(customer.find("SMSNO").text());
$("#dlistcmplist").append(table).append("
");
GetReloadUpdatePanel()
alert("success" + response.d);
});
$("#loader").hide();

}

</script>
Posted
Updated 21-Jan-14 2:37am
v2
Comments
Sampath Lokuge 21-Jan-14 8:04am    
How can we help to you without your code snippets ?
ZurdoDev 21-Jan-14 8:06am    
What's the question?

1 solution

Use Update Panel with your datalist and then use javascript function __doPostBack() to update Panel by passing Update Panel ClientID in it.
 
Share this answer
 
Comments
AS Rao 21-Jan-14 8:11am    
can u provide any sample code.
Er. Ajay Chauhan 21-Jan-14 8:16am    
<script type="text/javascript">
function GetReloadUpdatePanel() {
__doPostBack('<%=UpdatePanelName.ClientID %>', '')
}
</script>
Asp Tag:
<asp:UpdatePanel ID="UpdatePanelName" runat="server">
<contenttemplate>
Your Data List

AS Rao 21-Jan-14 8:30am    
its not working the panel is refreshing but data is not displayed in front end.
plz help me.
Er. Ajay Chauhan 21-Jan-14 8:49am    
check this in firebug -> console -> weather data is coming or not or any other error occurred in this.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900