I found this great example for modal popup from ericmartin
But I'm trying to use against a datalist of images produced by an ASP.NET repeater and not sure how to make the image dynamic.
The working code is simple but the image is static. It basically pops up th image an darkens the site that called it. it's all happening in javascript and css from that site.
<div id='container'>
<div id='content'>
<div id='basic-modal'>
<a href='#' class='basic'>Demoz</a>
</div>
<div id="basic-modal-content">
<img src="img/basic/127-2777_IMG.JPG" />
</div>
</div>
</div>
But my asp.net repeater code needs to somehow get/set the image value but getting "$get is undefined" error in my javascript.
here's my asp.net code:
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<script type="text/javascript">
function ShowFullImg(url) {
var img = $get("<%=Image1.ClientID %>");
img.src = url;
// $find("Image1").show();
}
</script>
<div id='container'>
<div id="basic-modal-content">
<asp:Image ID="Image1" runat="server" />
</div>
<ASP:DataList id="repeater1" runat="server" repeatdirection="Horizontal" RepeatLayout="Table" Repeatcolumns="5">
<ItemTemplate>
<asp:ImageButton ID="ThumbnailImg" ImageUrl='<%# Eval("n1") %>' Height="100" Width="150" BorderStyle="Ridge" OnClientClick='<%# Eval("n2","ShowFullImg(\"{0}\");return false;") %>' runat="server" />
</ItemTemplate>
</asp:DataList>
</div>
</asp:Content>
=== UPDATE: SOME MORE PROGRESS HERE. APPEARS MY ISSUE NOW IS WHEN I BIND AND UPDATE.
Here's my rendered code.. I'm getting a blank popup:
<script type="text/javascript">
function ShowFullImg(url) {
var img = $("#Maincontent_Image1");
img.src = url;
}
</script>
<div id='container'>
<div id="basic-modal-content">
<img id="Maincontent_Image1" src="" />
</div>
<div id='basic-modal'>
<table id="Maincontent_repeater1" cellspacing="0" style="border-collapse:collapse;">
<tr>
<td>
<input type="image" name="ctl00$Maincontent$repeater1$ctl00$ThumbnailImg" id="Maincontent_repeater1_ThumbnailImg_0" class="basic