I have custom field. This field contains video. In Render method I open modal dialog (SP.UI.ModalDialog), and inside of this dialog I display a video (with WebControls:MediaWebPart
).
The modal is created with JavaScript:
function loadPlayVideoDialog(){
var options = {
url: '(...)PlayVideo.aspx',
autoSize: true,
showClose: true,
dialogReturnValueCallback: SP.UI.ModalDialog.RefreshPage};
SP.UI.ModalDialog.showModalDialog(options);
PlayVideo.aspx is a page in Layouts. It looks like this:
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<html>
<body>
<table cellpadding="4" cellspacing="0" border="0" width="100%" style="margin-left:7px; margin-top:7px;">
<tr>
<td id="Td1" name="_invisibleIfEmpty" valign="top" width="100%">
<WebPartPages:WebPartZone runat="server" Title="loc:FullPage" ID="WebPartZone1" FrameType="TitleBarOnly">
<ZoneTemplate>
<WebControls:MediaWebPart runat="server" ID="MediaWebPart1" PreviewImageSource="/Style Library/Media Player/VideoPreview.png"
Height="340px" Width="420px" AutoPlay="True" ChromeType="None" Loop="False"
Description="Use to embed media clips (video and audio) in a web page."
DisplayMode="Inline" Title="Media Web Part"
__MarkupType="vsattributemarkup" __WebPartId="{99a603f3-3a85-4711-a551-4ed586dbce23}" WebPart="true" __designer:IsClosed="false" partorder="2" />
<div style="float:right">
<asp:Button Text="Close" runat="server" ID="btClose" OnClientClick="javascript:closeDialog()" />
</div>
</ZoneTemplate>
</WebPartPages:WebPartZone>
</td>
</tr>
</table>
</body>
</html>
The problem is, that I cannot close the modal dialog. The 'X' button in the corner doesn't do anything.
I even added a button, that calls SP.UI.ModalDialog.showModalDialog.close();
(see the btClose control?). It only reloads the video, but doesn't close the dialog.
Here's a screenshot: http://screencast.com/t/Xm3SlFP7fKG
What did I do wrong? How can I make close work?