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

Close and refresh without postback on the parent

3 Answers 421 Views
Window
This is a migrated thread and some comments may be shown as answers.
Deniz Torlak
Top achievements
Rank 1
Deniz Torlak asked on 30 Nov 2011, 11:17 AM
Hi there,

I have a situation and actually I can explain it using one of your examples. 
I am using a page like this;
http://demos.telerik.com/aspnet-ajax/window/examples/contenttemplatevsnavigateurl/defaultcs.aspx

My code uses the contenttemplate version and there is a small form with in the radwindow. Then the save button is clicked it does a postback from codebehind like in your example. What I want to do is when I click the save button I want to call a function in the parent page which runs some code and updates one of the 3 grids on the page and I want to do this using ajax without refreshing the whole parent page. 

However even if I use the ajaxmanager or the ajaxpanel I can open the radwindow via ajax but the save button always does a postback and make the whole parent page refresh (behaves like in your example code)

How can I do the postback via ajax from the radwindow (using contenttemplate) without refreshing the whole parent page?

thanks
Deniz

3 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 30 Nov 2011, 12:37 PM
Hello,

Take a look into the following forum thread which discussed the same.
How to trigger an Ajax postback on parentpage after closing radwindow

Thanks,
Princy.
0
Deniz Torlak
Top achievements
Rank 1
answered on 02 Dec 2011, 07:05 PM
Ok I guess I am missing something here. I prepared a  very simple example that represents my core problem

OpenWindow button opens the rad window with ajax but when I click the update button in the radwindow it does a full postpack on the parent page instead just closing the radwindow doing an ajax update on the CurrentText textbox. 

so what am i doing wrong?

Here is aspx page code 
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/iMarina.master" AutoEventWireup="true" CodeFile="AjaxandWindow.aspx.cs" Inherits="Sayfalar_Test_AjaxandWindow" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
 
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 
    <telerik:RadTextBox ID="CurrentText" runat="server"></telerik:RadTextBox>
    <telerik:RadButton ID="OpenWindow" runat="server" onclick="OpenWindow_Click" Text="Edit"></telerik:RadButton>
 
    <telerik:RadWindow ID="RadWindow1" runat="server">
        <ContentTemplate>
        <telerik:RadTextBox ID="UpdatedText" runat="server"></telerik:RadTextBox>
        <telerik:RadButton ID="Update" runat="server"  onclick="Update_Click" Text="Update"></telerik:RadButton>       
        </ContentTemplate>
    </telerik:RadWindow>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="OpenWindow">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadWindow1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="Update">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="CurrentText" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default" MinDisplayTime="5000">
    </telerik:RadAjaxLoadingPanel>
</asp:Content>

And here is the code behind:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
public partial class Sayfalar_Test_AjaxandWindow : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
    protected void OpenWindow_Click(object sender, EventArgs e)
    {
        this.RadWindow1.VisibleOnPageLoad = true;
    }
 
    protected void Update_Click(object sender, EventArgs e)
    {
        this.RadWindow1.VisibleOnPageLoad = false;
        CurrentText.Text = UpdatedText.Text;
    }
 
}


0
Marin Bratanov
Telerik team
answered on 06 Dec 2011, 04:59 PM
Hello Deniz,

I am not sure exactly how you have set up your RadWIndows, but I advise you examine the following help article on properly using RadWindow with AJAX: http://www.telerik.com/help/aspnet-ajax/radwindow-ajaxifying.html. I also suggest you examine this one on the correct way to open it from the code-behind: http://www.telerik.com/help/aspnet-ajax/radwindow-troubleshooting-opening-from-server.html which, I believe, can reduce the number of the required AJAX settings. The same approach can be adopted for executing a script that will close the RadWindow. You may also find useful this article on calling functions from the RadWindow in case you are using the NavigateUrl: http://www.telerik.com/help/aspnet-ajax/window-programming-calling-functions.html. Similar approach is shown in this online demo as well.


Regards,
Marin
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
Deniz Torlak
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Deniz Torlak
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or