This is a migrated thread and some comments may be shown as answers.

RadWindow rendering and destroyonclose

7 Answers 549 Views
Window
This is a migrated thread and some comments may be shown as answers.
Robby
Top achievements
Rank 1
Robby asked on 08 Apr 2013, 03:06 PM
If a radwindow with a contenturl is rendered as an iframe, how is one with a content template rendered?

Also,
What is the actual effect of using the destroy onclose property? If it is not used, how is the form "stored"?

7 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 09 Apr 2013, 04:05 PM
Hello Robby,

The only difference in the rendering is that if you load an entire page an iframe with the appropriate src attribute will be rendered inside the RadWindow, while the ContentTemplate renders as a simple div with the controls it hosts direclty inside, much like an ASP:Panel control.

You can observe the difference in the following demo: http://demos.telerik.com/aspnet-ajax/window/examples/contenttemplatevsnavigateurl/defaultcs.aspx.

I am pasting below the way the content cell of the RadWindow renders in both cases, all the other markup that creates the layout of the popup (borders, titlebar, statusbar, etc.) is the sam.

ContentTemplate:
<td class="rwWindowContent" valign="top">
  <div id="ctl00_ContentPlaceHolder1_RadWindow_ContentTemplate_C" style="overflow-x: auto; overflow-y: auto; border-top-color: currentColor; border-left-color: currentColor; border-right-color: currentColor; border-bottom-color: currentColor; border-top-width: 0px; border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-top-style: none; border-left-style: none; border-right-style: none; border-bottom-style: none; width: 284px; height: 237px;">
    <p class="contText">
                Enter a value here and click the button to close the RadWindow and pass the
                value to the main page.
            </p>
    <div class="contButton">
      <input name="ctl00$ContentPlaceHolder1$RadWindow_ContentTemplate$C$Textbox1" type="text" id="ctl00_ContentPlaceHolder1_RadWindow_ContentTemplate_C_Textbox1" class="rfdRoundedCorners rfdDecorated" tabindex="0">
    </div>
    <p class="contText">
                Via a simple JavaScript function:
            </p>
    <div class="contButton">
      <a href="javascript:void(0)" class="rfdSkinnedButton" tabindex="0">
        <input type="submit" name="ctl00$ContentPlaceHolder1$RadWindow_ContentTemplate$C$Button1" value="send value and close" onclick="populateValue(); return false;" id="ctl00_ContentPlaceHolder1_RadWindow_ContentTemplate_C_Button1" class="rfdDecorated" tabindex="-1">
      </a>
    </div>
    <p class="contText">
                Via a simple method in the code-behind:
            </p>
    <div class="contButton">
      <a href="javascript:void(0)" class="rfdSkinnedButton" tabindex="0">
        <input type="submit" name="ctl00$ContentPlaceHolder1$RadWindow_ContentTemplate$C$Button2" value="send value through code-behind" id="ctl00_ContentPlaceHolder1_RadWindow_ContentTemplate_C_Button2" class="rfdDecorated" tabindex="-1">
      </a>
    </div>
  </div>
</td>

External page:
<td class="rwWindowContent rwExternalContent" valign="top">
  <iframe name="RadWindow_NavigateUrl" src="Dialog.aspx" style="width: 100%; height: 100%; border-top-color: currentColor; border-left-color: currentColor; border-right-color: currentColor; border-bottom-color: currentColor; border-top-width: 0px; border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-top-style: none; border-left-style: none; border-right-style: none; border-bottom-style: none;" frameborder="0" tabindex="-1"></iframe>
</td>

These are taken direclty from the rendered output of the browser, so some styles are converted to inline styles and shorthands are expanded.


On the DesotroyOnClose property - it has no effect for a RadWindow that uses its ContentTemplate.

When an external page is loaded closing the popup will remove the markup the control has created from the page (it renders with JavaScript anyway), dispose the object and handlers and try to dispose the iframe (as much as is possible in the browser, as this is a bit of functionality the browser alone can handle).

In case DestroyOnClose is not enabled (its default state) when you close a RadWindow it will merely hide with CSS (display: none for the entire popup) so it can be shown afterwards immediately, without a reload. This allows for some caching of the content.

I hope this answers your questions.

Greetings,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Shark75
Top achievements
Rank 2
answered on 13 Mar 2014, 11:23 AM
Could the documentation please get updated to indicate the DestroyOnClose does not work with ContentTemplates in a similar way to how the ReloadOnShow property mentions it?

Thanks.
0
Marin Bratanov
Telerik team
answered on 13 Mar 2014, 12:04 PM
Hello

and thank you for your feedback. Indeed, it should be noted and I will make sure this is done for our next upload. I have updated your Telerik points as a small token of gratitude for your involvement.


Regards,
Marin Bratanov
Telerik

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

0
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
answered on 12 Aug 2016, 01:06 PM

Hi Marin,

 

I got some viewstate problems because I am adding controls to a RadWizard in a RadWindow with ContentTemplate using AJAX.

Would it be possible to destroy the RadWindow from JS code?

For next use it is then build up again from scratch.

There is no need for keeping the content.

 

Marc

0
Marin Bratanov
Telerik team
answered on 15 Aug 2016, 08:28 AM

Hello Marc,

RadWindow explicitly checks if the ContentTemplate is used. If it is, the DestroyOnClose functionality does nothing because it may otherwise break the developer's code.

If you like, you can review the dispose method in the RadWindow prototype to track what it does and implement similar logic in your app.

As for issues with the viewstate - a likely reason for such a problem is having the said RadWindow in a RadWindowManager. When the ContentTemplate is used, the RadWindow should not be in a manager's collection: http://docs.telerik.com/devtools/aspnet-ajax/controls/window/getting-started/using-radwindow-as-controls-container.

Of course, a rather easy alternative is to move the content to an aspx page and add a few function calls or a close event handler to return data.

Regards,

Marin Bratanov
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
answered on 15 Aug 2016, 09:20 AM

Hi Marin,

 

How could I do this:

If you like, you can review the dispose method in the RadWindow
prototype to track what it does and implement similar logic in your app.

 

0
Marin Bratanov
Telerik team
answered on 15 Aug 2016, 09:43 AM

You can download the source code from your account and go through the files in the Window folder of the Telerik.Web.UI project. I am attaching a short video that show how to get the source.

--Marin

Tags
Window
Asked by
Robby
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Shark75
Top achievements
Rank 2
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or