aniruddh kewat

aniruddh kewat

  • NA
  • 1
  • 860

how can i bind asp.net datalist which contains linkbutton on

Jun 28 2015 9:08 AM

here's my ajax code-onsuccess....

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("<%=dlproducts.RepeatColumns == 0 ? 1 : dlproducts.RepeatColumns %>");
var rowCount = Math.ceil(customers.length / repeatColumns);
var i = 0;
while (i < repeatColumns * rowCount) {
var row = $("[id*=dlproducts] 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());
//$(".lbtnaddtocart", row).eq(j).text(customer.find("Name").text());
//$(".lbtnaddtocart", row).eq(j).attr("CommandArgument", customer.find("ProductId").text());
}
i++;
}
$("[id*=dlproducts]").append(row);
}
//$("[id*=dlproducts] tr").eq(0).remove();
$("[id*=dlproducts]").show();
$("#loader").hide();
}

this is my Datalist...

<asp:DataList ID="dlproducts" runat="server" RepeatColumns="4" RepeatDirection="Horizontal"
Width="100%" Font-Bold="false" BackColor="AliceBlue" Font-Italic="false" Font-Overline="false"
Font-Strikeout="false" CellPadding="0" CellSpacing="0">
<ItemStyle Width="20%" BorderColor="Green" BorderWidth="5px" HorizontalAlign="Center"
VerticalAlign="Middle" />
<ItemTemplate>
<table cellpadding="0" cellspacing="0" border="0" style="width: 100%; height: 300px;
border: 2px solid Blue; background-color: ; text-align: center">
<tr>
<td>
<b><u><span class="name">
<%# Eval("Name") %></span></u></b>
</td>
</tr>
<tr>
<td>
<b>Productid: </b><span class="productId" style="font-size: 20px; color: Red; font-weight: 500;">
<%# Eval("Productid") %></span><br />
<b>Description </b><span class="description">
<%# Eval("Description") %></span><br />
<b>ImageUrl: </b><span class="imageUrl">
<%# Eval("ImageUrl")%></span><br />
<img class="image" alt='' src="Images/<%# Eval("ImageUrl")%>" width="160px" height="320px" /><br />
<b>Price: </b><span class="price">
<%# Eval("Price")%></span>
<img alt="" src="star-icon.png" />
<b>Quantity: </b><span class="quantity">
<%# Eval("Quantity")%></span><br />
<%-- <asp:LinkButton ID="LinkButton40" CssClass="lbtnaddtocart" runat="server" CommandArgument='<%#Eval("ProductId")%>'
OnClick="lbtnAddtocart_Click" BackColor="" ForeColor="" Width="120px" Font-Size="Larger">Add To Cart</asp:LinkButton>
--%>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>