This is a migrated thread and some comments may be shown as answers.
Open a RadWindow in an async postback?
1 Answer 68 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
SteveV asked on 16 Dec 2011, 12:49 AM
Not sure what I'm doing wrong.  I have an operation (initiated from a GridButtonItem click) that occurs inside an async postback.  Depending on the results of the operation I need to update image and label controls hosted in a RadWindow, display the RadWindow, wait for the user to click a button, determine the button that was clicked and continue with the operation.

For the life of me I can't get the RadWindow to open with generating an exception.  I've stripped out the RadGrid and simplified the code to try to find the problem but alas, no joy.

My aspx looks like this:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ZZRadWindow.aspx.cs" Inherits="SitefinityWebApp.ZZRadWindow" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<head runat="server">
        function OpenWindow()
            var wndMgr = GetRadWindowManager();
  "", "ConfirmPlaybackWindow");
            return false;
    <form id="form1" runat="server">
        <asp:ScriptManager runat="server" ID="ScriptMgr" />
        <asp:UpdatePanel ID="WindowUpdatePnl" runat="server">
            <asp:Label ID="msgLbl" runat="server" />
                <telerik:RadWindowManager ID="RadWindowManager1" ShowContentDuringLoad="false" VisibleStatusbar="false" ReloadOnShow="true" runat="server" Skin="Forest" EnableShadow="true" Font-Bold="False" Modal="True">
                        <telerik:RadWindow ID="ConfirmPlaybackWindow" runat="server" DestroyOnClose="False" Skin="Forest" Modal="True">
                                <div class="confirmationDlgWrp">
                                    <div class="alertWrp">
                                        <asp:Image ID="AlertImg" runat="server" CssClass="dlgIcon" />
                                        <asp:Label ID="AlertLbl" runat="server" CssClass="dlgLabel" Text="Hello World" />
                                    <div class="confirmationDlgBtnWrp">
                                        <asp:Button ID="YesBtn" runat="server" CssClass="dlgYesBtn" Text="Yes" />
                                        <asp:Button ID="NoBtn" runat="server" CssClass="dlgNoBtn" Text="No" />
                <asp:Button ID="PostBackButton" runat="server" Text="Do Postback" />
        <p />
        <asp:Button ID="Button1" runat="server" OnClientClick="return OpenWindow()" Text="Open RadWindow" />

And my codebehind looks like this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace SitefinityWebApp
    public partial class ZZRadWindow : System.Web.UI.Page
        private static int PostBackCount = 0;
        protected void Page_Load(object sender, EventArgs e)
            if (IsPostBack)
                msgLbl.Text = string.Format("{0}<p/>PostBackCount: {1}", msgLbl.Text, ++PostBackCount);
                string script2 = "<script type=\"text/javascript\">OpenWindow();</script>";
                ScriptManager.RegisterStartupScript(WindowUpdatePnl, typeof(string), "OpenWindow", script2, false);

Clicking the button located outside the UpdatePanel result in the RadWindow displaying without error.  Clicking the postback button located inside the UpdatePanel results in the following exception:

Microsoft JScript runtime error: Sys.InvalidOperationException: Can't be called after dispose

Any idea what I'm doing wrong here?

Thanks -- Steve 

1 Answer, 1 is accepted

Sort by
Marin Bratanov
Telerik team
answered on 19 Dec 2011, 09:48 AM
Hi Steve,

Please examine the following article on properly using the RadWindow with AJAX: In order to ajaxify the controls from its ContentTemplate you need top lace the update panel inside it. Then you could call its update() method in the code-behind as needed, or simply leave the UpdateMode to conditional. Please note that this scenario (an update panel inside the content template of a RadWindowMAnager) has some limitations related to the general way AJAX and collections work in ASP, which is explained here:

I also advise that you examine the following sticky thread on correctly opening the RadWindow from the server: There you can find the correct syntax for the RegisterStartupScript() method.

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
Asked by
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question