Click here to Skip to main content
15,891,841 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
how to show datalist item details in jquery popup window
Posted
Comments
What have you tried?

I have found below mentioned code for that.Try it.

if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Product info = (Product)e.Item.DataItem;
if (!string.IsNullOrEmpty(info.Name))
{
LinkButton hlnk = (LinkButton)e.Item.FindControl("buybutton2");

hlnk.Attributes.Add("productDescription",+info.RegisteredProductId.ToString()
+"-"+info.Name);

}}


XML
$("div#divDatalist .buylink").click(function (e) {
e.preventDefault();
var posy = e.pageY - (this.offsetTop - 10);
var _text = "";
var currentObjId = (this.id);
_text = $("a#" + currentObjId).attr('productDescription');

var partsArray = _text.split('-');
$("#<%= productid.ClientID %>").val(partsArray[0]);
$("#<%= pro_name_pop.ClientID %>").html(addNewlines(partsArray[1], 45));

loadPopup();//write your own logic to show popup div below
//return false;
});

<div id="divDatalist">
Wish List<br /> <br />
<asp:DataList ID="GiftDataListDetail" OnItemDataBound="GiftDataListDetail_ItemDataBound"
runat="server" DataKeyField="RegistryID">
<ItemTemplate>
<asp:LinkButton ID="buy" CssClass="buylink" runat="server" resourcekey="BuyNow" />
//other items
...........
</ItemTemplate>
</asp:DataList>
</div>

<div id="popupdiv">
<asp:HiddenField ID="productid" runat="server" />
<asp:Label ID="pro_name_pop" CssClass="pro_name_pop" runat="server" />
.............
</div>


For more info:

how to show datalist item details in jquery popup

I hope this will help to you.
 
Share this answer
 
the best way to do this job, you should use jquery colorbox which is easy to use and the effect is also too good.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900