How to Bind Datalsit in clientside using javascript and Jquery.I am using Webservice,if the ajax have success I want to bind the Datalist
.I tried some code
function succes(response) {
var value = $.parseXML(response.d);
var xvalue = $(value);
debugger;
var products = xvalue.find("tblProddetails");
var repeatColumns = parseInt("<%=dlViewProd.RepeatColumns == 0 ? 1 : dlViewProd.RepeatColumns %>");
var rowCount = Math.ceil(products.length / repeatColumns);
var i = 0;
while (i < repeatColumns * rowCount) {
var table = $("[id*=dlViewProd] tr").eq(0).clone(true);
for (var j = 0; j < repeatColumns; j++) {
var prod = $(products[i]);
if (prod.length == 0) {
$("table:last", table).remove();
}
else {
$("#img1", table).html($(this).find("ProductImage").text());
$("#lblPrice", table).html($(this).find("ProductPrice").text());
$("#lnkID", table).html($(this).find("ProductName").text());
$("#dlViewProd").append(table).append("<br/>");
table = $("#dlViewProd").eq(0).clone(true);
}
i++;
}
$("[id*=dlViewProd]").append(table);
}
$("[id*=dlViewProd] tr").eq(0).remove();
$("[id*=dlViewProd]").show();
}
this suggest you use it,there is an example in the demo
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.