User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 429,966 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,607 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 6460 | Replies: 1 | Solved
Reply
Join Date: Apr 2007
Location: Glasgow::Scotland
Posts: 10
Reputation: Blackred is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 2
Blackred's Avatar
Blackred Blackred is offline Offline
Newbie Poster

Small issue re: ModalPopupExtender - not firing ImageButton.Click event

  #1  
Apr 20th, 2007
Hello, first post so be kind

I'm using the ModalPopup to display a loading message when the user clicks on an imagebutton. The problem here is that while the ModalPopup is on screen, the button event doesn't fire so the page doesn't do anything - it just sits there with a loading message - here is my code...

    <div id="pnlLoading" style="display: none;" class="modalPopup">
        <p><img src="/images/mde_loading.gif" /> Contacting Cinema...</p>
    </div>
    <asp:ImageButton ID="ibtnCalculate" runat="server" ImageUrl="~/images/ordertickets.gif" />
    <ajaxToolkit:ModalPopupExtender ID="mde1" runat="server"
        TargetControlID="ibtnCalculate"
        PopupControlID="pnlLoading"
        BackgroundCssClass="modalBackground"
        DropShadow="true" />

I need it to fire the ibtnCalculate.Click and show the modal popup

Thanks,
Greg.
This station is non-operational.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2007
Location: Glasgow::Scotland
Posts: 10
Reputation: Blackred is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 2
Blackred's Avatar
Blackred Blackred is offline Offline
Newbie Poster

Re: Small issue re: ModalPopupExtender - not firing ImageButton.Click event

  #2  
Apr 20th, 2007
OK, I finally managed to get this cracked!

Basically you need an invisible button that you apply the ModalPopupExtender to, you then call the Click of this invisible button using javascript like this...

HTML:
<script type="text/javascript">
    function btnClick(id) {
        document.getElementById('ctl00_cpContent_btn' + id).click() // if you know of a better way to get this, let me know!
    }
</script>

<!-- Visible button -->
<asp:ImageButton ID="ibtnCancel" runat="server" ImageUrl="~/images/cancel.gif" />

<!-- Invisible button -->
<span style="display: none">
    <asp:Button ID="btnCancel" runat="server" />
</span>

<!-- Modal Popup Content -->
<div id="pnlLoading1" style="display: none;" class="modalPopup">
    <p><img src="~/images/mde_loading.gif" runat="server" /> Contacting Cinema...</p>
</div>

<ajaxToolkit:ModalPopupExtender ID="mde1" runat="server"
        TargetControlID="btnCancel"
        PopupControlID="pnlLoading1"
        BackgroundCssClass="modalBackground" />

Backend code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    ibtnCancel.Attributes.Add("onclick", "btnClick('Cancel')")
End Sub

That shows the Modal Popup and posts back to the server

Cheers,
Blackred.
This station is non-operational.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 11:43 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC