<div id="divBox">
Wish List<br /> <br />
<asp:DataList ID="GiftDataListDetail" OnItemDataBound="GiftDataListDetail_ItemDataBound"
runat="server" DataKeyField="GiftRegistryID">
<ItemTemplate>
<asp:Panel ID="meterbar2" runat="server" CssClass="meterbar">
<%--data --%>
</asp:Panel>
</div>
<div class="buybutton"><asp:LinkButton ID="buybutton2" CssClass="buylink" runat="server"/></div>
now in your ItemDataBound event in code behind file -
protected void GiftDataListDetail_ItemDataBound(object source, DataListItemEventArgs e)
{
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");
Panel pan = (Panel)e.Item.FindControl("meterbar2");
hlnk.Attributes.Add("productDescription",pan.ClientID);
}
}
}
at last use jquery in script section to show/hide panel on button click -
$("div#divBox .buylink2").click(function (e) {
e.preventDefault();
var panelid = "";
var currentObjId = (this.id);
panelid = $("a#" + currentObjId).attr('desc');
var realid = $("[id$=" + panelid + "]").attr("id");
$("#" + realid + "").slideToggle("slow");
});
If you have questions about this post or any topics, post your questions in
discussions/forum in this website, you will get your answer