如何将Linkbutton的命令参数传递给我的Pagescroll函数.. [英] How Do I Pass The Command Argument Of Linkbutton To My Pagescroll Function..
本文介绍了如何将Linkbutton的命令参数传递给我的Pagescroll函数..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$(window).scroll(function(){
if ($(window).scrollTop() == $(document).height() - $(window).height()){
GetRecords();
}
});
函数GetRecords(){
pageIndex ++;
alert(' PageIndex:' + pageIndex + ' ,页数:' + pageCount);
if (pageIndex == 2 || pageIndex < = pageCount){
$( #loader跨度>)表示();
$ .ajax({
type: POST,
url: Default.aspx / GetCustomers,
data:' {pageIndex:' + pageIndex + ' }',
contentType: application / json; charset = utf -8,
dataType: json,
成功:OnSuccess,
失败:函数(响应){
alert(' Hell 1');
},
错误:函数(响应){
alert(' Hell 2');
}
});
}
}
函数OnSuccess(响应){
var xmlDoc = $ .parseXML(response.d);
var xml = $(xmlDoc);
pageCount = parseInt(xml.find( PageCount)。eq( 0 )。find( PageCount)。 ());
var customers = xml.find( 顾客跨度>);
var repeatColumns = parseInt( < %= dlCustomers.RepeatColumns == 0?1:dlCustomers.RepeatColumns%>);
var rowCount = Math.ceil(customers.length / repeatColumns);
var i = 0 ;
while (i < repeatColumns * rowCount){
var row = $( [id * = dlCustomers] tr)。eq( 0 )。clone( true );
for ( var j = 0 ; j < repeatColumns; j ++){
var customer = $(customers [一世]);
if (customer.length == 0 ){
// alert('Bingo');
$( table:last,row)。 remove ();
} else {
$( .name,row).eq(j).html(customer.find( 名称跨度>)文本())。
$( .productId,row).eq(j).html(客户) .find( ProductId)。text());
$( 。description,row).eq(j).html(customer .find( Description)。text());
$( 。imageUrl,row).eq(j).html(customer .find( ImageUrl)。text());
$( 。image,row).eq(j).attr(< span class =code-string> src,' Images /' + customer.find( ImageUrl) 。文本());
$( 。price,row).eq(j).html(客户) .find( Price)。text());
$( 。quantity,row).eq(j).html(customer .find( Quantity)。text());
}
i ++;
}
$( [id * = dlCustomers])。追加(行);
}
// $([id * = dlCustomers] tr)。eq( 0).remove();
$( [id * = dlCustomers]< /跨度>)表示();
$( #loader)。hide();
}
解决方案
(窗口).scroll(function(){
if (
(window).scrollTop()==
(document).height() -
$(window).scroll(function () {
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
GetRecords();
}
});
function GetRecords() {
pageIndex++;
alert('PageIndex : ' + pageIndex + ' , Page Count : ' + pageCount);
if (pageIndex == 2 || pageIndex <= pageCount) {
$("#loader").show();
$.ajax({
type: "POST",
url: "Default.aspx/GetCustomers",
data: '{pageIndex:'+pageIndex+'}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert('Hell 1');
},
error: function (response) {
alert('Hell 2');
}
});
}
}
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");
var repeatColumns = parseInt("<%=dlCustomers.RepeatColumns == 0 ? 1 : dlCustomers.RepeatColumns %>");
var rowCount = Math.ceil(customers.length / repeatColumns);
var i = 0;
while (i < repeatColumns * rowCount) {
var row = $("[id*=dlCustomers] tr").eq(0).clone(true);
for (var j = 0; j < repeatColumns; j++) {
var customer = $(customers[i]);
if (customer.length == 0) {
//alert('Bingo');
$("table:last", row).remove();
} else {
$(".name", row).eq(j).html(customer.find("Name").text());
$(".productId", row).eq(j).html(customer.find("ProductId").text());
$(".description", row).eq(j).html(customer.find("Description").text());
$(".imageUrl", row).eq(j).html(customer.find("ImageUrl").text());
$(".image", row).eq(j).attr("src", 'Images/' + customer.find("ImageUrl").text());
$(".price", row).eq(j).html(customer.find("Price").text());
$(".quantity", row).eq(j).html(customer.find("Quantity").text());
}
i++;
}
$("[id*=dlCustomers]").append(row);
}
//$("[id*=dlCustomers] tr").eq(0).remove();
$("[id*=dlCustomers]").show();
$("#loader").hide();
}
解决方案
(window).scroll(function () { if (
(window).scrollTop() ==
(document).height() -
这篇关于如何将Linkbutton的命令参数传递给我的Pagescroll函数..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文