<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <style type="text/css"> .divModalBackground { filter: alpha(opacity=50); -moz-opacity: 0.5; opacity: 0.5; width: 100%; background-color: #999988; position: absolute; top: 0px; left: 0px; z-index: 800; } </style> </head> <body> <form id="form1" runat="server"> <div> <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> </asp:ToolkitScriptManager> <asp:Image runat="server" ID="image2" ImageUrl="images/small/ground_main.jpg" /> <asp:Image runat="server" ID="image3" ImageUrl="images/small/R.C.C main.jpg" /> <asp:Image runat="server" ID="image4" ImageUrl="images/small/rehab_main.jpg" /> <asp:Image runat="server" ID="image5" ImageUrl="images/small/steel_main.jpg" /> <asp:Button ID="btnPop" runat="server" Text="Button" Style="display: none" /> <asp:Panel runat="server" ID="panel1" Style="display: none; background-color: White;"> <div style="text-align: center; padding: 0 5px"> <asp:Button runat="server" ID="btncancel" Text="close" /></div> <img id="popImg" src="" /> </asp:Panel> <asp:ModalPopupExtender ID="modal1" runat="server" BackgroundCssClass="divModalBackground" TargetControlID="btnPop" PopupControlID="panel1" CancelControlID="btncancel" OnCancelScript="hpop()" RepositionMode="RepositionOnWindowScroll"> </asp:ModalPopupExtender> </div> </form> </body> <script language="javascript" type="text/javascript"> function mpop(path) { document.getElementById("popImg").src = path; $find('modal1').show(); return false; } function hpop() { $find('modal1').hide(); } </script> </html>
protected void Page_Load(object sender, EventArgs e) { // since the original images are in the folder named "big" i'm changing the path as follows... image2.Attributes.Add("onclick", "return mpop('" + image2.ImageUrl.Replace("small", "big") + "');"); image3.Attributes.Add("onclick", "return mpop('" + image3.ImageUrl.Replace("small", "big") + "');"); image4.Attributes.Add("onclick", "return mpop('" + image4.ImageUrl.Replace("small", "big") + "');"); image5.Attributes.Add("onclick", "return mpop('" + image5.ImageUrl.Replace("small", "big") + "');"); // i.e the path 'images/small/ground_main.jpg' will became 'images/big/ground.main.jpg' }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)