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

RadWindow not popping up

1 Answer 60 Views
Window
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 2
Bill asked on 07 Jun 2010, 09:54 PM
I have to set up a RadWindow from code behind and then display it. It needs to be set up from the code-behind, because an event needs to fire to copy a file which the child page will display. After the file copy, I want the window to pop up. Nothing happens. The page just postsback with no activity.

When I try putting it in the html and not the code behind, it works fine. Only problem is like I said above is that when the user clicks on the image, it needs to copied.  The JS OnClientClick event obvioulsy fires before the OnClick server side event (which does the file copying). Therefore, it has to be done in the code behind. If somebody can help me figure out what I'm doing wrong, I would greatly appreciate it.

Here is my abbreviated HTML. Note that the RadScriptManager resides on a MasterPage:
<code>

<

 

telerik:RadWindowManager ID="RadWindowManager1" runat="server">

 

 

</telerik:RadWindowManager>

 

<%-- <Windows>

<telerik:RadWindow ID="RadWindow1" runat="server" ShowContentDuringLoad="false" Width="1000px"

Height="600px" Title="View Chart" Behaviors="Default" Skin="Outlook" Modal=true>

</telerik:RadWindow>

</Windows>--%>

<%--<script type="text/javascript">

//<![CDATA[

function openRadWin() {

radopen("../scan/viewChart.aspx", "RadWindow1");

}

//]]>

</script>--%>

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" UpdatePanelsRenderMode="Inline">

 

 

<AjaxSettings>

 

 

<telerik:AjaxSetting AjaxControlID="RadGridBulkCharts">

 

 

<UpdatedControls>

 

 

<telerik:AjaxUpdatedControl ControlID="RadGridBulkCharts" LoadingPanelID="RadAjaxLoadingPanel1" />

 

 

</UpdatedControls>

 

 

</telerik:AjaxSetting>

 

 

<telerik:AjaxSetting AjaxControlID="chkBulk">

 

 

<UpdatedControls>

 

 

<telerik:AjaxUpdatedControl ControlID="chkBulk" LoadingPanelID="RadAjaxLoadingPanel1" />

 

 

</UpdatedControls>

 

 

</telerik:AjaxSetting>

 

 

<telerik:AjaxSetting AjaxControlID="RadGridEDLogFiles">

 

 

<UpdatedControls>

 

 

<telerik:AjaxUpdatedControl ControlID="RadGridEDLogFiles" LoadingPanelID="RadAjaxLoadingPanel1" />

 

 

</UpdatedControls>

 

 

</telerik:AjaxSetting>

 

 

<telerik:AjaxSetting AjaxControlID="chkEDLog">

 

 

<UpdatedControls>

 

 

<telerik:AjaxUpdatedControl ControlID="chkEDLog" LoadingPanelID="RadAjaxLoadingPanel1" />

 

 

</UpdatedControls>

 

 

</telerik:AjaxSetting>

 

 

</AjaxSettings>

 

 

</telerik:RadAjaxManager>

 

 

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">

 

 

</telerik:RadAjaxLoadingPanel>
<code>

Notice I have the client code commented out which I said works fine just to see if it gets into the page_load event of the child page. It does from the client side (when the code is uncommented), but from the server side, the Load event is not hit.

Here is my abbreviated server side code in the event once the onclick event happens:
<code>

 

protected void Chart_Click(object sender, ImageClickEventArgs e)
        {
           
            file = new FileInfo(ChartPath + imgName);
            string cpPath = (string)settingsReader.GetValue("tmpImageFolder", typeof(String)) + ViewState["UserName"].ToString();

            if (file.Exists)
            {
                if (!Directory.Exists(cpPath))
                {
                    Directory.CreateDirectory(cpPath);
                }

                file.CopyTo(cpPath + file.Name, true);

                RadWindowManager1.Windows.Clear();
                RadWindow newwindow = new RadWindow();
                newwindow.ID = "RadWindow1";
                newwindow.ShowContentDuringLoad = false;
                newwindow.Width = Unit.Pixel(1000);
                newwindow.Height = Unit.Pixel(600);
                newwindow.Title = "View Chart Image";
                newwindow.Behaviors = WindowBehaviors.Default;
                newwindow.Skin = "Outlook";
                newwindow.Modal = true;
                newwindow.VisibleOnPageLoad = true;
                newwindow.NavigateUrl = "../scan/viewChart.aspx";
                newwindow.Visible = true;
                RadWindowManager1.Windows.Add(newwindow);

            }
        }


</code>

I checked the  RadWindowManager1.Windows.Count property and shows it to be 1.

What am I doing wrong that the page doesn't come up???

1 Answer, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 14 Jun 2010, 08:09 AM
Hi William,

I recommend you to use this approach in order to open a RadWindow from code behind.

Regards,
Fiko
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Window
Asked by
Bill
Top achievements
Rank 2
Answers by
Fiko
Telerik team
Share this question
or