this jquery simple model add-in code works great to popup a fiXed image http://www.ericmmartin.com/projects/simplemodal-demos/ i'm trying to use inside an asp.net datalist solutoin that grabs images from a directory, but the problem is not ASP.NET or C# related.
can't seem to make it DYNAMIC CHANGE WHICH IMAGE pops up (see this post for details).. If I use a set img src it works
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<script type="text/javascript">
function ShowFullImg(url) {
var img = $("#<%=Image1.ClientID %>");
img.src = url;
function ShowFullImg(url) {
var img = $("#<%=Image1.ClientID %>");
img.src = url;
}
</script>
</script>
<div id='container'>
<div id="basic-modal-content">
<asp:Image ID="Image1" runat="server" />
</div>
<div id='basic-modal'>
<ASP:DataList id="repeater1" runat="server" repeatdirection="Horizontal" RepeatLayout="Table" Repeatcolumns="5">
<ItemTemplate>
<ItemTemplate>
<asp:ImageButton ID="ThumbnailImg" class="basic" ImageUrl='<%# Eval("n1") %>' Height="100" Width="150" BorderStyle="Ridge" OnClientClick='<%# Eval("n2","ShowFullImg(\"{0}\");return false;") %>' runat="server" />
</ItemTemplate>
</asp:DataList>
</asp:DataList>
</div>
</div>
</asp:Content>
I suspect my problem is when I'm calling the javascript that updates the image.src i've likely already bound.
Agaom. my issue is NOT ASP.NET or C# related - at it is building the grid of thumbnails. I just want to be able to change the image that pops up (Image1) with the correctly selected image.
No image pops up,just an empty popup box box. My rendered code looks like this:
<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" src="products/af/124-2424_IMG.JPG" onclick="ShowFullImg("products/af/124-2424_IMG.JPG");return false;" style="border-style:Ridge;height:100px;width:150px;" />
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" src="products/af/124-2424_IMG.JPG" onclick="ShowFullImg("products/af/124-2424_IMG.JPG");return false;" style="border-style:Ridge;height:100px;width:150px;" />
Many Thanks in advance for you help
-- You received this message because you are subscribed to the Google Groups "JavaScript Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javascript-information+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.