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:
<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 ;)