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

RadWindow in UpdatePanel does full postback

1 Answer 289 Views
Window
This is a migrated thread and some comments may be shown as answers.
Frank
Top achievements
Rank 1
Frank asked on 10 Sep 2012, 09:18 AM
Hi.
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
            }
            SP.UI.ModalDialog.showModalDialog(options);
        }
</script>


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>
    </telerik:RadAjaxPanel>
</asp:Content>


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


PopupWindowControlPage
: 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">
    <Windows>
        <telerik:RadWindow runat="server" ID="rwContractInput" VisibleStatusbar="False" VisibleTitlebar="True" Behaviors="None" IconUrl="~/_layouts/images/BLANK.GIF" AutoSize="True" EnableShadow="True">
            <ContentTemplate>
                <RKWindows:InputDialogControl runat="server" ID="contractInputControl" Width="400px" Height="500px" />
            </ContentTemplate>
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>
<asp:Panel runat="server" ID="ContainerPanel">
    <asp:Button runat="server" Text="Show Popup Dialog" ID="ShowPopup" OnClick="OnShowPopupClick"/>
</asp:Panel>


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,
Frank

1 Answer, 1 is accepted

Sort by
0
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: http://www.telerik.com/help/aspnet-ajax/window-ajaxifying.html. 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.


Greetings,
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.
Tags
Window
Asked by
Frank
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or