[RESOLVED] Lightbox - If Image is not visible set "data-lightbox="
Hi All,
It's been a while and therefore I am a little rusty.... :eek2:
I'm using lightbox (http://lokeshdhakar.com/projects/lightbox2/) to display a 6 images in a ASP.NET repeater looks great and almost does every thing i need.
I have set the .vb to make imagename.visible=false if the imageUrl=""... again works like a charm and I only see images that have a value in the database.
The problem i have is in order to list how many images in each set Lightbox uses an attribute in the HTML Hyperlink tag called 'data-lightbox'.
Code:
<a class="example-image-link" data-lightbox='<%# DataBinder.Eval(Container.DataItem, "id") %>' href="<%# "../uploads/" & DataBinder.Eval(Container.DataItem, "image5") %>">
<asp:Image ID="Image6" ImageUrl='<%# "../uploads/tb_" & DataBinder.Eval(Container.DataItem, "image5") %>' width="45px" runat="server"/>
</a>
The problem is that when 3/6 images are uploaded and populated in the database lightbox still says there are 6 in the set even though only 3 are visible.
What i would like to do is in the .vb code when i check to see if the database field for the image is blank is set the data-lightbox value accordingly so visible images get a data-lightbox value only and are therefore added to the set.
Tried a .net Hyperlink too but same issue...
Code:
<asp:HyperLink id="hyp1" runat="server" class="example-image-link" data-lightbox='<%# "../uploads/" & DataBinder.Eval(Container.DataItem, "id") %>' href='<%# "../uploads/" & DataBinder.Eval(Container.DataItem, "image") %>'>
<asp:Image ID="Image1" ImageUrl='<%# "../uploads/" & DataBinder.Eval(Container.DataItem, "image") %>' Visible='<%# IIf(Eval("Image") Is DbNull.Value, "False","True") %>' width="280px" runat="server"/>
</asp:HyperLink>
How can i change a custom attribute in a HTML form from the VB.net code behind?
Hope that make sense and i have provided enough detail!
Thanks
Steve
Re: Lightbox - If Image is not visible set "data-lightbox="
58 views 0 replies means i probably didn't explain this very well : )
Matters not a good nights sleep and several coffees and i cracked it in all of 5 minutes tonight.
Code:
DirectCast(e.Item.FindControl("hyp1"), System.Web.UI.WebControls.HyperLink).Attributes.Add("data-lightbox", Convert.ToString(DataBinder.Eval(e.Item.DataItem, "Id")))