?
Solved

More AJAX ModalPopup Questions (with MasterPages)

Posted on 2009-02-08
1
Medium Priority
?
1,238 Views
Last Modified: 2012-06-21
I have created a master page and put a modalpopup, the associated panel, and dummy control, and am trying to launch it on a form's button click.  The click event is called (a small javascript routine),  but it does not finc the popup to tell it to "Show".

I have included all the code fragments.  Pretty much everything is in the master page and the buttons appear and when I click the button on the default.aspx page I get the message that the javascript routine is being called, but the modalExtenderPopup id is not being found.
'SiteMaster.Master'
<%@ Master Language="VB" CodeFile="SiteMaster.master.vb" Inherits="SiteMaster" %>
 
<!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>Untitled Page</title>
    
<link href="css/SiteStyleSheet.css" rel="stylesheet" type="text/css" />
 
<link href="css/ModalPopupStyles.css" rel="stylesheet" type="text/css" />
   
<script language="javascript" type="text/javascript">
 
function HideModalPopup() 
{ 
  var modal = $find('mpe'); 
  if(modal)
  {
    modal.hide(); 
  }
  else
  {
  alert('Cannot find modal');
  }
}
 
function ShowMyModalPopup() 
{ 
  alert ('Hi');
 var modal = $find('mpe'); 
  if(modal)
  {
   modal.show(); 
  }
  else
  {
  alert('Cannot find modal');
  }
}
 
function fnClickUpdate(sender, e) 
{ 
  __doPostBack(sender,e); 
}
 
</script>   
    
</head>
<body>
 
    <form id="form1" runat="server">
    
    
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        
    <div>
        <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
        
<asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" Height="485px" Width="645px" style="display:none">
 
    <center>
    <br />
    <IFRAME id="frame1" width="640px" height="480px" scrolling="auto" runat="server">
    </IFRAME>
    </center>
 
    <asp:Button ID="Button1" runat="server" Text="OK" /> 
    <asp:Button ID="Button2" runat="server" Text="Cancel" /> 
 
</asp:Panel>
 
<asp:Button runat="server" ID="txtDummy" style="display:none"  />
<ajaxToolkit:ModalPopupExtender  ID="mpe" runat="server"    
    TargetControlID="txtDummy"
    PopupControlID="Panel1"
    OkControlID="Button1"
    CancelControlID="Button2" 
    DropShadow="true"
    BackgroundCssClass="modalBackground"
    RepositionMode="RepositionOnWindowResize">
    
</ajaxToolkit:ModalPopupExtender>
 
<br />
        
</asp:contentplaceholder>
    </div>
    
<Button ID="cmdShowPage" value ="A Button" title="Buttonie" type="button" onclick="ShowMyModalPopup();">
    Abutton</Button><br />
    
    </form>
    
</body>
</html>
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Modal Popup Styles Style Sheet
*Modal Popup*/
.modalBackground {
	background-color:Gray;
	filter:alpha(opacity=70);
	opacity:0.7;
}
 
.modalPopup {
	background-color:#ffffdd;
	border-width:3px;
	border-style:solid;
	border-color:Gray;
	padding:3px;
	width:250px;
}
 
 
.modalPanelAsTable TABLE
   {
      border: #060F40 2px solid;
      color: #060F40;
      background: #ffffcc;
   }
 
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Open in new window

0
Comment
Question by:Howard Bash
1 Comment
 
LVL 18

Accepted Solution

by:
David Robitaille earned 2000 total points
ID: 23590466

add a BehaviorID to your modal popup.
could try BehaviorID="mpe" so you wont have to change anything
 
from http://www.asp.net/AJAX/AjaxControlToolkit/Samples/Walkthrough/ExtenderClasses.aspx
  • BehaviorID: In cases where you would like to access the client-side behavior for your extender from script code in the client, you can set this BehaviorID to simplify the process.  See example below:
  • <ns:MyExtender ID="myExtender1"
    runat="server" TargetControlID="Button1" BehaviorID="myBehavior1" />
    <script type="text/javascript">
    function changeValue() {
    var myBehavior = $find("myBehavior1");
    myBehavior.set_Value(0);
    }
    </script>
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Suggested Courses
Course of the Month13 days, 10 hours left to enroll

749 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