I saw several posts regarding this topc. I noticed one code. I also worked on the same code n the below code url .
Binding asp.net datalist with jQuery
function OnSuccess(response) {
$("[id*=dlOnFrontPageProducts]").attr("border", "1");
var xmlDoc = $.parseXML(response.d);
var xml = $(xmlDoc);
var customers = xml.find("Table1");
var row = $("[id*=dlOnFrontPageProducts] tr:last-child").clone(true);
$("[id*=dlOnFrontPageProducts] tr:last-child").remove();
$.each(customers, function () {
alert(this);
var customer = $(this);
$(".Name", row).html(customer.find("Name").text());
$(".BrandName", row).html(customer.find("BrandName").text());
$(".MarketPrice", row).html(customer.find("MarketPrice").text());
$(".CurrencyShortName", row).html(customer.find("CurrencyShortName").text());
$(".Price", row).html(customer.find("Price").text());
$(".WindowImageUrl", row).html(customer.find("WindowImageUrl").text());
$(".SaleCount", row).html(customer.find("SaleCount").text());
$(".IsActive", row).html(customer.find("IsActive").text());
$("[id*=dlOnFrontPageProducts]").append(row);
row = $("[id*=dlOnFrontPageProducts] tr:last-child").clone(true);
});
}
<asp:DataList ID="DataList1" runat="server" AutoGenerateColumns="false" Font-Names="Arial"
Font-Size="10pt" RowStyle-BackColor="#A1DCF2" HeaderStyle-BackColor="#3AC0F2" HeaderStyle-ForeColor = "White">
<ItemTemplate>
<asp:Label ID="lbldescription" runat="server" Text='<%# Eval("description")%>'>
</asp:Label>
<asp:Label ID="name" runat="server" Text='<%# Eval("name")%>'>
</asp:Label>
</ItemTemplate>
How can I bind using ajax and jquery. My page takes 16 seconds to load the page. That’s y i am going for jquery.
Please help me for finding solution….
Thanks
You will not be able to
BindaDataListcontrol via jQuery because the control is only created when bound through server side code, e.g. on the code behind.If you are wanting to use Ajax and jQuery to
bindcontrols, then you would be better of using plain old HTML.Alternatively, bind the
DataListwith some data so that it is rendered, and then the HTML elements will be created on the page and you can work with them.