Click here to Skip to main content
15,881,866 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Sir,
I want to show image in a popup on button click and my button is inside the gridview.
I have image path and name in session which is save in folder.
For eg. - "~/Image/abc.jpg"

Thanks
Posted
Comments
_Amy 15-Sep-12 2:24am    
What have you tried yet? Where you stuck?
ritesh88sharma 15-Sep-12 2:27am    
i have Image name, path and id in session. i don't know how to pass this image id and path in java script function. please tell me any way to show image in popup.

 
Share this answer
 
try this:

.aspx file:
ASP.NET
<cc1:modalpopupextender id="mp1" runat="server" popupcontrolid="Panel1" targetcontrolid="btnShow" xmlns:cc1="#unknown">
    CancelControlID="btnClose" BackgroundCssClass="modalBackground">
</cc1:modalpopupextender>
<asp:panel id="Panel1" runat="server" cssclass="modalPopup" align="center" style="display:none" xmlns:asp="#unknown">
    This is an ASP.Net AJAX ModalPopupExtender Example<br />
<asp:image id="img1" runat="server">
                            ImageUrl='~/Image/abc.jpg'></asp:image>
    <asp:button id="btnClose" runat="server" text="Close" />
</asp:panel>


.aspx.cs file: (Button Click Event)
C#
void Btn_Click(Object sender, EventArgs e)
    {
        mp1.show(); // Model popup id .show function is to open poup on button click event
    }
 
Share this answer
 
Comments
ritesh88sharma 15-Sep-12 2:53am    
thanks u sir,
but i have image url (path) in session. how to use it. it is my problem. please tell me solution...
prashant patil 4987 15-Sep-12 3:08am    
set ImageUrl like below code:
img1.ImageUrl = Convert.toString(Session["Imagepath"]); // Imagepath is Session Variable.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900