Hi,
I'm trying to close a RadWindow using a button defined in the RadWindow's ContentTemplate, but I'm having trouble getting a reference to the RadWindow object using my GetWindow() javascript function. It's the same GetWindow function that I use in other RadWindows (and that's used in various Telerik examples) and it works fine, except in those scenarios I'm using the NavigateURL property instead of ContentTemplate.
I'm using Firefox right now, so I expect the first part of the if-clause in the GetWindow() function to execute, but instead it drops down into the else-clause and then I get a frameElement is null error (since it's Firefox I assume.) But really the first part of the if-clause should be executing.
Here is a sample:
Thanks for your help, -Scott
ASP:
JavaScript:
I'm trying to close a RadWindow using a button defined in the RadWindow's ContentTemplate, but I'm having trouble getting a reference to the RadWindow object using my GetWindow() javascript function. It's the same GetWindow function that I use in other RadWindows (and that's used in various Telerik examples) and it works fine, except in those scenarios I'm using the NavigateURL property instead of ContentTemplate.
I'm using Firefox right now, so I expect the first part of the if-clause in the GetWindow() function to execute, but instead it drops down into the else-clause and then I get a frameElement is null error (since it's Firefox I assume.) But really the first part of the if-clause should be executing.
Here is a sample:
Thanks for your help, -Scott
ASP:
<telerik:RadWindowManager Skin="WebBlue" ID="RadWindowManager2" onAutoSize="true" Behaviors="Close" VisibleStatusbar="false" runat="server"> |
<Windows> |
<telerik:RadWindow Skin="WebBlue" AutoSize="true" ID="RadCommentWindow" IconUrl="favicon.ico" runat="server"> |
<ContentTemplate> |
<asp:Label runat="server">Please enter a comment:<br />(max 1000 characters)</asp:Label><br /> |
<textarea rows="7" style="width: 400px;" id="txtComment"></textarea><br /> |
<asp:Button runat="server" ID="Button1" Text="OK" OnClientClick="if(!OnClientClose()) { return false; }" /> |
</ContentTemplate> |
</telerik:RadWindow> |
</Windows> |
</telerik:RadWindowManager> |
JavaScript:
function GetRadWindow() { |
var oWindow = null; |
if (window.radWindow) oWindow = window.radWindow; |
else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; |
return oWindow; |
} |
function OnClientClose(oWnd, args) { |
GetRadWindow().close() |
} |