Vasanth Jack

Vasanth Jack

  • NA
  • 289
  • 35.2k

How to Bind A datalist in clientside using JS in asp.net

Nov 25 2016 2:43 AM
How to Bind datalist in Client side using Jquery and Ajax,I tried But i cant bind the datalsit.I get the values from server side but i cannot bind the values in the client side.Please Help.
 
Already Am using Webmethod to get the values from server.Here Is my code
 
function succes(response) {
var xmlDoc = $.parseXML(response.d);
var xml = $(xmlDoc);
var customers = xml.find("tblProddetails");
debugger;
var repeatColumns = parseInt("<%=dlViewProd.RepeatColumns == 0 ? 1 : dlViewProd.RepeatColumns %>");
var rowCount = Math.ceil(customers.length / repeatColumns);
var i = 0;
while (i < repeatColumns * rowCount) {
var row = $("[id*=dlViewProd]").eq(0).clone(true);
for (var j = 0; j <repeatColumns; j++) {
var customer = $(customers[i]);
if (customer.length == 0) {
$("table:last", row).remove();
}
else {
$("#img1", row).eq(j).html(customer.find("ProductImage").text());
$("#lblPrice", row).eq(j).html(customer.find("ProductPrice").text());
$("#lnkId", row).eq(j).html(customer.find("ProductName").text());
}
i++;
}
$("[id*=dlViewProd]").append(row);
}
$("[id*=dlViewProd] ").eq(0).remove();
$("[id*=dlViewProd]").show();
}
 

Answers (4)