Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

making basic modal example dynamic to asp.net datalist.

$
0
0

I found this great example for modal popup on ericmartin.com . google ericmartin simple modal.

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>


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>