?
Solved

Button in ModalPopupExtender not calling server function

Posted on 2007-11-27
5
Medium Priority
?
3,206 Views
Last Modified: 2012-05-05
I have a page with a print button that first calls a ModalPopupExtender that asks the user what reports they want to print (3 radio buttons, "Print" button and "Cancel" button). The "Cancel" button dismisses the ModalPopup as expected. The "Print" button should then call a Sub routine to check which radio button is selected, generate the appropriate report for printing and dispaly it in a new ModalPopup.

My problem at this this stage is that when I click the "Print" button the page will display the second ModalPopup, but does not call the server routine to check the values from the first popup or populate the second one.
' Code in .aspx
--------------------------------
<asp:Panel ID="pnlReport" runat="server" CssClass="ReportButtons" Visible="false">
	<asp:ImageButton ID="btnPrint" runat="server" ImageUrl="~/Images/Icon/print.gif" />
</asp:Panel>
 
<asp:Panel ID="pnlPrint" runat="server" CssClass="modalPopup" style="display: none;">
	<h3>Select reports to print:</h3>
	<p><asp:RadioButton ID="rbAgent" runat="server" GroupName="Report" Checked="true" /> Agent - Property information<br />
	<asp:RadioButton ID="rbBuyer" runat="server" GroupName="Report" /> Buyer - Property Information (Excludes owner and sale information)<br />
	<asp:RadioButton ID="rbAgentBuyer" runat="server" GroupName="Report" /> Agent & Buyer - Property Information</p>
	<div class="center">
		<asp:Button ID="btnPrintPrint" runat="server" Text="Print" />
		<asp:Button ID="btnPrintCancel" runat="server" Text="Cancel" />
	</div>
</asp:Panel>
<cc1:ModalPopupExtender ID="mpePrint" runat="server" TargetControlID="btnPrint" PopupControlID="pnlPrint" CancelControlID="btnPrintCancel" OkControlID="btnPrintPrint" BackgroundCssClass="modalBackground" DropShadow="true"></cc1:ModalPopupExtender>
 
<asp:Panel ID="pnlPrintOutput" runat="server" CssClass="modalPopup" style="display: none;">
	<asp:Label ID="lblPrintOutput" runat="server"></asp:Label>
</asp:Panel>
<cc1:ModalPopupExtender ID="mpePrintOutput" runat="server" TargetControlID="btnPrintPrint" PopupControlID="pnlPrintOutput" BackgroundCssClass="modalBackground"></cc1:ModalPopupExtender>
 
 
' Code in .aspx.vb
--------------------------------
' This routine never gets called
Protected Sub btnPrintPrint_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPrintPrint.Click
    If rbAgent.Checked Then
        GenerateAgentReport()
        lblPrintOutput.Text = sbAgentReport.ToString
        mpePrintOutput.Show()
    End If
...
End Sub
 
Protected Sub GenerateAgentReport()
...
End Sub

Open in new window

0
Comment
Question by:DerekWatling
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 4

Accepted Solution

by:
S31B1 earned 750 total points
ID: 20356690
Remove the property [OkControlID="btnPrintPrint"] from the first Modal Extender, if you use this property it deals with everything on the clientside, remove it and it will force a server side action.
0
 

Author Comment

by:DerekWatling
ID: 20357004
Still not having any luck. I have set break points in my code, but it never seems to get there.
0
 

Author Comment

by:DerekWatling
ID: 20357341
This is all inside an UpdatePanel inside a TabPanel inside an UpdatePanel and uses a MasterPage.

"pnlReport" has to stay where it is. When I try moving the 2 modal panels outside the inner UpdatePanel or to the begining/end of the page I get the following runtime errors respectively:
    "An extender can't be in a different UpdatePanel than the control it extends."
and
    "The TargetControlID of 'mpePrint' is not valid. A control with ID 'btnPrint' could not be found."
0
 

Author Comment

by:DerekWatling
ID: 20358070
Been experimenting all afternoon and found that if I only have 1 ModalPopupExtender everything works as expected. As soon as I add the 2nd one it doesn't! Is this a bug with AJAX? I'm using Visual Web Developer 2008 Express, ASP.NET 2.0 AJAX Extensions 1.0.61025, Ajax Control Toolkit 10920 and testing in IE7.

Ultimately what I want to achieve is to be able to generate a reports for printing and emailing. I plan on doing this as HTML and using CSS for page breaks, etc. I already have the data on the page and have stored it in a Public Shared DataRow variable so that I don't need to re-query the database. Our current system brings up the report in a new popup window. Due to the number of calls we already recieve from clients who have problems because of (multiple) popup-blockers I want to generate the report on the same page, either in a modal popup or a tab panel. This brings me to the problem of how to only print the contents of the selected panel. Would putting it in an <IFRAME> solve this issue? Any other suggestions?
0
 

Author Comment

by:DerekWatling
ID: 20363882
I am assigning the points for a partial solution and valuble information.

Regarding my printing issue I have posted a new question at http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_22986940.html
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month9 days, 21 hours left to enroll

762 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