Admin update: You can follow this article and the sample it provides to create an adaptive RadWindow https://docs.telerik.com/devtools/aspnet-ajax/controls/window/mobile-support/responsive,-adaptive-and-elastic-capabilities#fluid-or-adaptive-design-with-radwindow and you can also tweak the provided code through the rich client-side API of the control so it matches your concrete requirements. RadWindow is one of the controls we use a lot in our applications. As our applications get more and more optimized to be used on smartphones and tablets, we tried to redo some of our functionality or replace them with RadLightboxes or other ways. But the RadLightbox lacks a lot of the functionality the RadWindow has: windowmanager, dialogs, more focussed on regular web-page content,.... I have been waiting for adaptive RadWindow functionality for quite some time, and I really hope I'm not the only one! Today I've read your Q1 2015 road map and I decided to finally post this feature request here too (I contacted your support team about this a few weeks ago). It's easy to dynamically create windows using the windowmanager, pass data between them, show dialogs, etc... It would be very nice to be able to still have all this functionality, but with added adaptive behavior. If the viewport width is too small to display the window or dialog in a correct way, the window/dialog would need to open maximized immediately without restricting height/width. It would be nice to keep the title-bar and the close functionality on top, but I really don't need to move, minimize, maximize, pin,... the window on a smartphone, only be able to view its contents, interact with the content and close the window if needed. A bit like your lightbox does, but less focused on images/galleries and more flexible using the managers and the existing API these windows already have. This would of course need to work for windows with url's (iframe), contenttemplates, and dialogs too. I like the Bootstrap modal-window, for example. If your windows/dialogs could behave a bit more like that on mobile devices, but would keep the functionality of the window-manager, adding iframe-content, dialogs, I would be more than happy! Thanks Nick
Based on customer report: scrollbar of RadWindow disappears after moving the window. Producible on our demos -- http://demos.telerik.com/aspnet-ajax/window/examples/minmaxsize/defaultcs.aspx. Note: Chrome specific bug: https://bugs.chromium.org/p/chromium/issues/detail?id=641881
FF 52 and Chrome58 seem to have started reading some CSS from 2010 differently.
This affects controls such as RadMenu, RadTreeView, RadPanelBar, RadEditor, RadListBox, RadTabStrip that are in the ContentTemplate of a RadWindow. The issue can manifest as bad element alignment or extra padding.
Internal fix will be available as of R2 2017.
There are two workarounds:
- use the Lightweight Render Mode (helps in some cases)
- add a CSS override similar to the following
/* FireFox 52+ and Chrome 58+ */
html:first-child .RadWindowFixed ul {
float: none !important;
}
<telerik:RadWindow ID="RadWindow2" runat="server" Title="Rad Window with RadTreeView - Fixed" Width="400px" MinWidth="230px" MaxWidth="600px" CssClass="RadWindowFixed"
Height="610px" VisibleOnPageLoad="true" Behaviors="Minimize, Move, Maximize, Resize" VisibleStatusbar="false" KeepInScreenBounds="true" Left="406">
The content scrollbars of RadWindow are not shown in Lightweight if ShowContentDuringLoad="false". The bug is specific to Chrome.
----------------------------------------
Workarounds:
1. Use the control in RenderMode=Classic
2. Enable the ShowContentDuringLoad="true" property
3. or attach a handler to the RadWindow's OnClientPageLoad proeprty and call the restore() method of the control in it:
<telerik:RadWindow RenderMode="Lightweight" ID="RadWindow1" ShowContentDuringLoad="false" VisibleOnPageLoad="true" Width="600px" Height="400px" Title="Wikipedia" OnClientPageLoad="onLoad"
NavigateUrl="https://www.wikipedia.org" runat="server">
</telerik:RadWindow>
<script>
function onLoad(sender, args) {
sender.restore();
}
</script>
----------------------------------------
Steps to reproduce:
1. Run the following code:
<telerik:RadWindow RenderMode="Lightweight" ID="RadWindow1" ShowContentDuringLoad="false" VisibleOnPageLoad="true" Width="600px" Height="400px" Title="Wikipedia"
NavigateUrl="https://www.wikipedia.org" runat="server">
</telerik:RadWindow>
Result: No scroll bars are shown, they apper after moving the window
You can work around this by storing the currently focused element before calling autoSize()
and then using the OnClientAutoSizeEnd event (http://www.telerik.com/help/aspnet-ajax/window-client-side-events-onclientautosizeend.html) to restore the focus.
//this goes in the content
function autoSizeWnd() {
//code that manipulates the content so autosizing is needed
var oWnd = getRadWindow();
if ($telerik.isIE) { //assumes you have the Telerik core client-side libraries loaded (e.g., by having a Telerik control on this page). If you don't, you can skip the check or add them manually
oWnd.__currActElem = document.activeElement;
}
oWnd.autoSize();
}
//this goes in the main page where the RadWindow is declared
function autoSizeEndHandler(sender, args) {
setTimeout(function () {
if (sender.__currActElem && sender.__currActElem.focus) {
sender.__currActElem.focus();
}
}, 0);
}
The easiest workaround is to remove the overlay (e.g., set the Overlay property to false or call the set_overlay(false) client-side method). In most cases an overlay is not needed, as it is used only for showing the popup over heavyweight objects like PDFs, Flash or Java applets: http://www.telerik.com/support/kb/aspnet-ajax/window/details/control-is-shown-behind-a-heavy-weight-object-(pdf-flash-activex-etc)
The idea is to let a simple property have the RadWindow close on outside click like the RadLightBox: http://demos.telerik.com/aspnet-ajax/lightbox/examples/overview/defaultcs.aspx. At the moment, a few lines of code are needed and you can find examples here: http://www.telerik.com/forums/close-modal-on-overlay-click#DGbE7tSl3kWR926gm99m9A.
The wrapper of the RadAlert/Confirm/Prompt buttons is wider than the dialog itself in Material skin, in IE/Chrome: https://www.screencast.com/t/4IatOUgMp Steps to reproduce: 1. Open in Chrome: http://demos.telerik.com/aspnet-ajax/window/examples/browserdialogboxes/defaultcs.aspx?skin=Material 2. Click on any of the demo buttons (e.g. RadAlert from Client) Result: The wrapper of the Dialog buttons is wider than the dialog itself
A workaround is to call the _updateTitleWidth() method in the OnClientAutoSize event. A small sample is attached below.
/*lightweight mode*/
.RadWindow_Metro div.rwTitleBar,
.RadWindow_MetroTouch div.rwTitleBar
{
background-color: #25a0da;
}
/*if you want to remove the sides padding*/
/*.RadWindow.RadWindow_Metro,
.RadWindow.RadWindow_MetroTouch
{
padding-left: 0px;
padding-right: 0px;
padding-bottom: 0px;
}*/
/* if you want all the borders blue */
/*div.RadWindow_Metro,
div.RadWindow_MetroTouch
{
border-color: #25a0da;
background-color: #25a0da;
}*/
/* when Classic form decorator is prsent it adds a white border and changes the font size of h6 elements, avoid that for the Lightweight Radwindow if you cannot move to a Lightweight form decorator as well*/
div.RadWindow h6.rwTitle
{
border-bottom: none;
font-size: inherit;
}
To remove the built-in icon for the Lightweight mode, add the following CSS rules to your page:
div.rwDialog.rwAlertDialog:before
{
content: "";
}
div.rwDialog.rwConfirmDialog:before
{
content: "";
}
Most notable issues
- Metro skin does not show the correct (blue) color. For a timeline and status updates for the Lightweight mode follow https://feedback.telerik.com/Project/108/Feedback/Details/216601-wrong-titlebar-colors-in-metro-and-metrotouch-skins-in-lightweight-rendermode
- RTL mode does not order the buttons properly
Workarounds for both:
/*lightweight mode*/
.RadWindow_Metro div.rwTitleBar,
.RadWindow_MetroTouch div.rwTitleBar
{
background-color: #25a0da;
}
/* if you want all the borders blue */
div.RadWindow_Metro,
div.RadWindow_MetroTouch
{
border-color: #25a0da;
background-color: #25a0da;
}
.rwRtl .rwCommands li.rwListItem
{
float: right;
}
/* classic mode- metro skin color issue*/
div.RadWindow_Metro .rwTitleRow
{
background-color: #25a0da;
}
This is caused by <button> elements without a type attribute. Workarounds are
- add a JS function like this
Sys.Application.add_load(function () {
// Add the "type=button" attribute to the RadWindow buttons so they don't try to submit the form.
$("div.rwDialogButtons button").attr("type", "button");
});
- OR, override the templates and add the attribute:
<asp:TextBox ID="Textbox1" runat="server" />
<telerik:RadWindowManager ID="rwm1" runat="server" RenderMode="Lightweight">
<AlertTemplate>
<div class="rwDialog rwAlertDialog">
<div class="rwDialogContent">
<div class="rwDialogMessage">{1}</div>
</div>
<div class="rwDialogButtons">
<button type="button" class="rwOkBtn" onclick="$find('{0}').close(true); return false;">##LOC[OK]##</button>
</div>
</div>
</AlertTemplate>
<PromptTemplate>
<div class="rwDialog rwPromptDialog">
<div class="rwDialogContent">
<div class="rwDialogMessage">{1}</div>
<div class="rwPromptInputContainer">
<script type="text/javascript">
function RadWindowprompt_detectenter(id, ev, input) {
if (!ev) ev = window.event;
if (ev.keyCode == 13) {
var but = input.parentNode.parentNode.parentNode.getElementsByTagName("button")[0];
if (but) {
if (but.click) {
but.click();
}
else if (but.onclick) {
but.focus();
var click = but.onclick;
but.onclick = null;
if (click) click.call(but);
}
}
return false;
}
else return true;
}
</script>
<input title="Enter Value" onkeydown="return RadWindowprompt_detectenter('{0}', event, this);" type="text" class="rwPromptInput radPreventDecorate" value="{2}" />
</div>
</div>
<div class="rwDialogButtons">
<button type="button" class="rwOkBtn" onclick="$find('{0}').close(this.parentNode.parentNode.getElementsByTagName('input')[0].value); return false;">##LOC[OK]##</button>
<button type="button" class="rwCancelBtn" onclick="$find('{0}').close(null); return false;">##LOC[Cancel]##</button>
</div>
</div>
</PromptTemplate>
<ConfirmTemplate>
<div class="rwDialog rwConfirmDialog">
<div class="rwDialogContent">
<div class="rwDialogMessage">{1}</div>
</div>
<div class="rwDialogButtons">
<button type="button" class="rwOkBtn" onclick="$find('{0}').close(true); return false;">##LOC[OK]##</button>
<button type="button" class="rwCancelBtn" onclick="$find('{0}').close(false); return false;">##LOC[Cancel]##</button>
</div>
</div>
</ConfirmTemplate>
</telerik:RadWindowManager>
Workaround
Telerik.Web.UI.RadWindow.prototype.set_restrictionZoneID = function(value) {
this._restrictionZoneID = value;
if (value && this.isCreated()) {
this.fitInRestrictionZone();
}
}
Error message: Unable to get property '_handlesCollection' of undefined or null reference
when RenderMode=Lightweight
Workarounds:
- enable the default behaviors to enable the Resize (and thus- maximize0 functionality, restore behaviors later:
function OpenForm(sender, args) {
var oWnd = radopen(null, "existing");
var currBehaviors = oWnd.get_behaviors();
oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Default);
if (!oWnd.isMaximized()) {
oWnd.maximize();
}
oWnd.set_behaviors(currBehaviors);
}
- OR, have the Behaviors property contain either of the Maximize or Resize behavior. Or use the Default value
<telerik:RadWindowManager runat="server" ID="rwm1">
<Windows>
<telerik:RadWindow runat="server" ID="existing" Behaviors="Close, Resize">
</telerik:RadWindow>
</Windows>
</telerik:RadWindowManager>
<telerik:RadButton ID="Button5" Text="open existing rw from rwm 3" AutoPostBack="false" OnClientClicked="OpenForm" runat="server"></telerik:RadButton>
<script>
function OpenForm(sender, args) {
var oWnd = radopen(null, "existing");
}
function OnClientShow(sender, args) {
if (!sender.isMaximized()) {
sender.maximize();
}
}
</script>
The IE iframe module crashes, most likely because of the fact that events do not bubble to iframes.
A workaround is to call a function that will increase the z-index when it activates. The attached example shows a workaround.
The ContentTemplate is designed as a container for server controls, so you would need to declare and use a RadWindow with a ContenTemplate (even blank) for this to work as expected. The ContentTemplate element is not created upon client-side setting at this point, so having a content that is not where it is supposed to be may break the control afterwards (e.g., if autosizing is used).
A workaround is to create a dummy content template that can alleviate most issues:
var wnd = radopen(null, wndName);
//create an imitation of the ContentTemplate
if (!wnd.___customContentElemCreated) {
$telerik.$("iframe", wnd.get_popupElement()).remove();
var cElem = document.createElement("div");
cElem.setAttribute("id", wnd.get_id() + "_C");
cElem.style.display = "";
cElem.style.overflow = "auto";
cElem.style.border = "0px";
wnd.set_contentElement(cElem);
wnd.setWidthDockMode(wnd.get_width());
wnd.setHeightDockMode(wnd.get_height());
wnd.___customContentElemCreated = true;
}
wnd,set_contentElement(theNewElem);
You can find attached three pages that illustrate the problem and mainpage.aspx offers a workaround. Steps to reproduce, if the workaround is removed: 1) Browse the MainPage.aspx 2) Click the "Show RadWindow 1" button 3) In the first RadWindow, click the "Show RadWindow 2" to open the child modal RadWindow (Content Page 2) -- if you click the "Show Current Active Window" button in content page 1, you can see the current active window is the "Content Page 1" which is correct. 4) Maximize the second RadWindow and close it 5) Back in the first RadWindow, click the "Show Current Active Window" button, the current active window will host the "Content Page 2" and will have the ID of the second dialog