Solved

How can I use modalpopup extender to show a bigger version of an image?

Posted on 2008-06-14
2
292 Views
Last Modified: 2013-11-26
Hi Experts

I have a formview in C#.
In this fv I have an image that is wrapped in a hyperlink. What I want to achieve is another image to popup when I click the image in the formview. Diffusing?

What I have so far is that the image opens in a new window. But I want the image to open in a modalpopup window.
Someone please help me?

This is my .aspx code, I have no code behind

<asp:FormView ID="fvVarebilde" runat="server" DataKeyNames="vareID" DataSourceID="SqlDataSource_fvVaredetalj">
        <ItemTemplate>
        <asp:hyperlink ID="ImageID" runat="server" target="_blank" navigateurl='<%# Eval("filnavn","bilder/{0}") %>' >
        <img src='<%# Eval("hovedbilde","bilder/{0}")%>' height="130" width="110" alt="produktbilde" />
        </asp:hyperlink>
        </ItemTemplate>
        </asp:FormView>

Open in new window

0
Comment
Question by:Raggdog
  • 2
2 Comments
 

Author Comment

by:Raggdog
ID: 21788458
C'mon Experts... anyone that know something about ajax??

I changed my code, so that my image is not in a hyperlink, but in an <imagebutton>. This because of the OnClick and code behind. I need help on this because I can not make this work. I click the image... the page reloads...and nothing more happens. I want a new image to show in a modalpopup.

I have done this before, but not in a formview... Is that a problem?

This is my .aspx and code behind

<asp:FormView ID="fvVarebilde" runat="server" DataKeyNames="vareID" DataSourceID="SqlDataSource_fvVaredetalj">
        <ItemTemplate>
            <asp:ImageButton ID="showModalPopup" runat="server" ImageUrl='<%# Eval("hovedbilde","bilder/{0}")%>' OnClick="showModalPopup_Click" />
            <p class="mini">Klikk på bildet...</p>
        
        
        <asp:Panel ID="programmaticPopup" CssClass="modalPopup" style="display:none;width:520px;padding:10px" runat="server">
        <img src='<%# Eval("filnavn","bilder/{0}")%>' height="500" width="500" alt="produktbilde" />
               <asp:LinkButton runat="server" ID="hideModalPopup" Text="Lukk" OnClick="hideModalPopup_Click" />
        
        
        </asp:Panel>
        </ItemTemplate>
        </asp:FormView>
        <asp:Button runat="server" ID="hiddenTargetControlForModalPopup" style="display:none"/>
        
        
        <ajaxToolkit:ModalPopupExtender BehaviorID="programmaticModalPopupBehavior" 
            ID="programmaticModalPopup" 
            runat="server" 
            TargetControlID="hiddenTargetControlForModalPopup" 
            PopupControlID="programmaticPopup">
        
        </ajaxToolkit:ModalPopupExtender>
 
 
// and .cs
 
protected void showModalPopup_Click(object sender, EventArgs e)
    {
        this.programmaticModalPopup.Show();
    }
    protected void hideModalPopup_Click(object sender, EventArgs e)
    {
        this.programmaticModalPopup.Hide();
    }

Open in new window

0
 

Accepted Solution

by:
Raggdog earned 0 total points
ID: 21795396
Ahh never mind.... I figured it out my self ;)
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to check group permission on a file located on a remote server ? 3 24
Open a link in vb.net 2 15
VB.NET Textbox input validation 4 37
Please explain purpose of GZIP 4 34
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question