I tried to use a RadWindows as a container, I put a radtextbox it in.
Then I wanted my user to right click on a listbox item and then Click "Edit" (from a RadContextMenu), I want to update the textbox based on the user's selection. So I need to open RadWindow from Server Side code. But if I use the OpenElementID properties, the client side event of the "Edit" item won't be fired.
Any idea?
Andy Ho
12 Answers, 1 is accepted
The following code snippet shows how to open radwindow from code behind.
CS:
RadWindow window1 = new RadWindow(); window1.NavigateUrl = "http://www.google.com"; window1.VisibleOnPageLoad = true; window1.Width = 500; window1.Height = 300; this.form1.Controls.Add(window1);You can also try one of the approaches described in this KB article.
-Shinu.
Thanks for your reply. But I can't create the radwindow from server side as I already create the window declaractively. So what I need is to show that RadWindow but not create that RadWindow.
Can I simply use VisibleOnPageLoad =true to make it work?
Andy Ho
Absolutely - if the RadWindow is already present on the page, setting VisibleOnPageLoad to true will make it show.
Greetings,
Georgi Tunev
the Telerik team
I used RadWindowManager1.Windows[2].VisibleOnPageLoad = true; on server side code to display Radwindow. I am closing it on button click as below. Everything is working as expected (window closes, grid rebinds) but I see a java script error. How can I avoid this javascript error ( b is null), this seems to be related to some callback function. Can someone help me in solving this.
Javascript:
In Main page:
function refreshScheduler(arg) {
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindSchedule|");
}
Javascript in a page that is opened in RadWindow
function GetRadWindow()
{
var oWindow = null;
if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz as well)
return oWindow;
}
function CloseWnd()
{
GetRadWindow().BrowserWindow.refreshScheduler();
GetRadWindow().close();
}
C# code
On Button Click close rad window:
ScriptManager.RegisterStartupScript(this, GetType(), "closeWnd", "CloseWnd();", true);
Thanks
Prava
I fixed the issue using javascript function.
i added a radwindow in my page, that is worked perfectly befor adding "RadFileExplorer", after added fileexplorer it's style changed to FileExplorer style.
i used this code.
telerik:RadWindowManager ID="RadWindowManager1" runat="server" ReloadOnShow="true" ShowContentDuringLoad="False" VisibleStatusbar="False" Behavior="Default" InitialBehavior="None" EnableEmbeddedSkins="False" EnableEmbeddedBaseStylesheet="False" Font-Names="Tahoma" VisibleOnPageLoad="false" Style="z-index: 8000;" DestroyOnClose="True">
<Windows> <telerik:RadWindow ID="window1" runat="server" IconUrl="none" Behavior="Close" DestroyOnClose="True" Modal="True" Width="650px" Height="190px" ></telerik:RadWindow></Windows></telerik:RadWindowManager>
<tr><td colspan="2"><telerik:RadFileExplorer ID="testFileExp" runat="server" Skin="Office2007" Width="100%"></telerik:RadFileExplorer></td></tr>
i have added images please find the images.
This behavior is expected - RadFileExplorer uses its own RadWindowManager to show the dialogs. RadWindowManager's functions (radopen, radalert, radpromt, GetRadWindowManager, etc.) however, always use the last RadWindowManager that is rendered on the page - in this case, it would be the one from the RadFileExplorer with its Skin property set to Office2007.
To open a RadWindow from a specific RadWindowManager, you need to get a reference to it first and then call its open() method (which is the same as the radopen() one).
e.g.
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" ReloadOnShow="true" ShowContentDuringLoad="False" VisibleStatusbar="False" Behavior="Default" InitialBehavior="None" Skin="Black" Font-Names="Tahoma" VisibleOnPageLoad="false" Style="z-index: 8000;" DestroyOnClose="True"> <Windows> <telerik:RadWindow ID="window1" runat="server" IconUrl="none" Behavior="Close" DestroyOnClose="True" Modal="True" Width="650px" Height="190px"> </telerik:RadWindow> </Windows></telerik:RadWindowManager><telerik:RadFileExplorer ID="testFileExp" runat="server" Skin="Office2007" Width="100%"></telerik:RadFileExplorer> <script type="text/javascript"> function showSpecificWin() { var oWndManager = $find("<%= RadWindowManager1.ClientID %>"); oWndManager.open('http://bing.com', 'window1'); } </script><button onclick="showSpecificWin(); return false;">test</button>Greetings,
Georgi Tunev
the Telerik team
Setting a z-index style to the window manager works properly on my side - http://www.telerik.com/support/kb/aspnet-ajax/window/details/show-radwindow-above-radmenu
Could you please elaborate more about the issue - what is the actual and the expected behavior of the control? Also, does upgrading to the latest version - 2015.2.826 helps?
Regards,
Danail Vasilev
Telerik
Hi John,
The Style property is not a standard property for a server control, even a simple Panel control does not show it: http://screencast.com/t/YBMNDi6tY. It is treated like a custom attribute by intellisense for some reason.
Regards,
Telerik
I have main page and I am using rad window in it like below.
Main Page
<telerik:RadWindowManager RegisterWithScriptManager="true" ID="wmgWindowManager" ReloadOnShow="true" runat="server"
Behavior="Move" ShowContentDuringLoad="false" DestroyOnClose="true">
<windows>
<telerik:RadWindow ID="wndAssignPerformer" RegisterWithScriptManager="true" ShowContentDuringLoad="false" runat="server" OnClientClose="RefreshPerformer" />
</windows>
<confirmtemplate>
<uc:Confirm ID="confirmValidation" runat="server"></uc:Confirm>
</confirmtemplate>
</telerik:RadWindowManager>
Inside above rad window I am opening another page "Sub_Page.aspx". Inside "Sub_Page" I am using pop up extender like below.
<telerik:radpopupextender id="extPopup" runat="server" OnOkSelected="extPopup_OkSelected" >
<telerik:RadPopupControl UniqueId="ReassignPerformer" WindowManagerId="wmgWindowManager" Disabled="true" ControlId="btnSave"
MessageType="Confirm" Height="120" Width="450" PostBackOnOk="true" PostBackOnCancel="false"
StartupScript="true" TitleKey="CONFIRMATION" MessageKey="REASSIGNPERFORMER" />
<afs:RadPopupControl UniqueId="ReassignClaimOwner" WindowManagerId="wmgWindowManager" Disabled="true" ControlId="btnSave"
MessageType="Confirm" Height="120" Width="450" PostBackOnOk="true" PostBackOnCancel="false"
StartupScript="true" TitleKey="CONFIRMATION" MessageKey="REASSIGNCLAIMOWNER" />
</telerik:radpopupextender>
<telerik:radwindowmanager id="wmgWindowManager" runat="server">
<Windows>
<telerik:RadWindow ID="wndAssignPerformer" runat="server" />
</Windows>
<ConfirmTemplate>
<uc:Confirm ID="confirmValidation" runat="server"></uc:Confirm>
</ConfirmTemplate>
</telerik:radwindowmanager>
on OnOkSelected event of pop up extender I am calling "extPopup_OkSelected" function of code behind file like below.
private void extPopup_OkSelected(System.Object sender, System.EventArgs e)
{
//do some server coding
System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(),
"Javascript", "function closeWindowOnSave(){var oWnd = $find(\"<%= wndAssignPerformer.ClientID%>\"); if(oWnd !=null){oWnd.close()} else {window.parent.close();} ;} closeWindowOnSave();", true);
}
}
My issue is that when I click on OK button my modal pop up get spinning. I want that when I click on Ok, after server processing complete my modal pop up
should close. But my javascript is not getting called from page behind
When I am opening "Sub_Page" directly from browser javascript is getting executed but when it opens inside rad window it is not.
I am facing this issue is Internet Explorer 11 only. Can you please help on this?