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

RadWindow in UpdatePanel does full postback

1 Answer 264 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Frank asked on 10 Sep 2012, 09:18 AM
I have a problem with Telerik RadWindow.
If a PostBack is sent by the RadWindow the whole page containing the RadWindow will get refreshed. How can this be prevented?
Here is a picture of the structure of my project.

And a little explanation of the problem (with the code):

JS Code: gets executed when a link is clicked inside the webpart.ascx
<script type="text/javascript">
        function OpenWindowOfThisShit() {
            var layoutsPageUrl = SP.Utilities.Utility.getLayoutsPageUrl('PopupWindowTest/PopupWindowTestLayoutPage.aspx');
            var options = {
                url: layoutsPageUrl,
                title: 'Popup Webpart',
                allowMaximize: false,
                showClose: true,
                width: 550,
                height: 550

The PopupWindowTestLayoutPage: This gets loaded inside the ModalDialog
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    <telerik:RadAjaxPanel runat="server">
            <asp:PlaceHolder runat="server" ID="placeHolder" Visible="True"></asp:PlaceHolder>

PopupWindowTestLayoutPage codebehind:
protected override void OnInit(EventArgs e)
                UserControl userControl = (UserControl)Page.LoadControl(@"~/_CONTROLTEMPLATES/PopupWindowTest/PopupWindowControlPage.ascx");
            catch (Exception ex)
                throw new Exception(ex.Message);

: This file gets loaded inside the placeholder of the LayoutPage
<%@ Register TagPrefix="RKWindows" TagName="InputDialogControl" Src="~/_controltemplates/PopupWindowTest/InputWindow.ascx" %>
<%@ Register Assembly="Telerik.Web.UI,Version=2011.3.1305.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
    Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<telerik:RadWindowManager ID="rwmInfo" runat="server">
        <telerik:RadWindow runat="server" ID="rwContractInput" VisibleStatusbar="False" VisibleTitlebar="True" Behaviors="None" IconUrl="~/_layouts/images/BLANK.GIF" AutoSize="True" EnableShadow="True">
                <RKWindows:InputDialogControl runat="server" ID="contractInputControl" Width="400px" Height="500px" />
<asp:Panel runat="server" ID="ContainerPanel">
    <asp:Button runat="server" Text="Show Popup Dialog" ID="ShowPopup" OnClick="OnShowPopupClick"/>

InputWindow: contains a inputField and a button
<asp:TextBox runat="server" ID="tbInput"></asp:TextBox>
<asp:Button runat="server" ID="FillTextbox" Text="Fill Textbox" OnClick="OnFillTextboxClick"/>

InputWindow codebehind

protected void OnFillTextboxClick(object sender, EventArgs e)
            tbInput.Text = "Filled!";

When the "Fill Textbox" button is clicked the Layoupage.ascx refreshes and resizes.
This is just an example of the real project where several RadGrids are used which will disappear for a short amount of time after a button was clicked inside a RadWindow.

I hope you can point me in the right direction.

Thank you in advance,

1 Answer, 1 is accepted

Sort by
Marin Bratanov
Telerik team
answered on 11 Sep 2012, 10:43 AM
Hello Frank,

The RadWindow renders at the beginning of the form, so using it with AJAX when you add controls to its ContentTemplate is a bit tricky. The details are available in the following help article: Said shortly - you would need an update panel in the ContentTemplate. This however, can pose another problem because you have added it in a RadWindowManager. More details about this situation are available in this KB article and I would suggest as a simple option to move the RadWindow out of the RadWindowManager or to remove the manager if you only use it for this window. A RadWindow can "live" on the pages separately without a manager.

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