0

I have a RadWindow as following:

<telerik:RadWindow ID="PIQRadWindow" Modal="true" runat="server" Skin="Default" Behaviors="Close,Move" CssClass="RadWindowCustomClass" VisibleStatusbar="false" width="400px" OnClientClose="RadWindowClose">
    <ContentTemplate>
    <pd:uc_PopupDropdown ID="pdPIQScore" enableviewstate="False" Draggable="true" isInternal="true" ISOC="ProjectInstructionQuality" DivContent = "pdPIQScore" ScriptPrefix = "OFS_" runat="server" />  
    </ContentTemplate>     
    </telerik:RadWindow>

I want it to be closed within a onclick event I defined. I tried to use

   function getRadWindow() {
      var oWindow = null;
      if (window.radWindow) oWindow = window.radWindow;
      else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
      return oWindow;
   }

   function clientClose() {   
      getRadWindow().close();
   }

But it's not working for me. Error message: "window.frameElement is null".

Anyone has ideas?

Joyin
  • 295
  • 1
  • 3
  • 11
  • Finally I find I can still use $find("<%=PIQRadWindow.ClientID%>").close() to close it. Not necessarily make it so complicated. – Joyin Jan 23 '14 at 22:17

2 Answers2

1

You must use $find() when using the ContentTemplate. You can either keep a reference in a global JS variable (you can populate the variable in Sys.Application.Load), or create functions that will open and close the dialog and call them whenever needed. Check this demo's code: http://demos.telerik.com/aspnet-ajax/window/examples/contenttemplatevsnavigateurl/defaultcs.aspx.

rdmptn
  • 5,413
  • 1
  • 16
  • 29
0

Have you checked out this post? If so, please share some more of your code so we can see exactly whats going on. How to close the radwindow on serverside and refresh the parent page

Community
  • 1
  • 1
Rick james
  • 824
  • 1
  • 11
  • 30
  • Yeah, they all use similar getRadWindow() function. But I got error from this function: window.frameElement is null. – Joyin Jan 23 '14 at 17:48
  • Are you able to access the window from the code behind by name? – Rick james Jan 23 '14 at 18:09
  • Your control lists "RadWindowClose" yet your function says clientClose() – ShellNinja Jan 23 '14 at 18:50
  • @Rickjames No, I can't access the window in "uc_PopupDropdown". Oh maybe that's why. So do you know how can I make it work in this way? I mean, keep using uc_PopupDropdown in contenttemplate. THANKS! – Joyin Jan 23 '14 at 19:24