Click here to Skip to main content
15,921,279 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i am developed a image gallery in asp.net ..in that having hyperlink so i am write below code for that in header part..now i would like write for asp image1 ..so how to change the script in asp.net

my script:
ASP.NET
<script type="text/javascript" charset="utf-8">
$(document).ready(function () {
$("a[rel^='prettyPhoto']").prettyPhoto();
});
</script> 
 
in aspx file;;
<a href='<%# Eval("Name","admin/galimg/{0}")%>' rel="prettyPhoto[pp_gal]" title="Gallery">
<img src='<%# Eval("Name","admin/galimg/{0}")%>' class="img_gallery" alt='<%# Eval("Name") %>' />
</a>
 
 <asp:Image ID="Image1" runat="server" class="img_gallery"  ImageUrl='<%# Eval("imagepath") %>' />
Posted
Updated 21-Dec-15 0:03am
v2

1 solution

if you would read one more line of documentation here:
http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/documentation[^]

You would know that:
“Just add rel=”prettyPhoto” to the link you want prettyPhoto to be enabled on. Refer to the demos on the main project page for all the possibilities.”

So you don't want to put rel attribute on you image, but on your anchor tag.

so you have to wrap asp:Image into anchor with correct rel tag
example:
ASP.NET
<a href="#" rel="prettyPhoto"> 
<asp:Image ID="Image1" runat="server" class="img_gallery"  ImageUrl='<%# Eval("imagepath") %>' />
</a>


Another solution is to change your selector:
$("a[rel^='prettyPhoto']")

to something else ;)
 
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