Updating a window's content during an ajax callback (and showing)

  1. #1

    Updating a window's content during an ajax callback (and showing)



    I am using coolite 0.8
    I have an ext:window control on one of my pages that is opened through an ajax event. The code behind that handles the ajax event changes some properties on a control that is inside the <Body> of the ext:window and then calls .show() on the ext.window... When the child control's properties change, the control ends up changing a Label during its prerender.
    ...
    The problem is that the content inside the child control (a Label in this case) is not updating on return of the ajax callback.

    If I change the Label to an ext:Label, then it updates on the first .show(), but if I close the ext:window and call .show() again, I get a JS error in the coolite.js (if I remove the ext:Label I can .show() / hide / .show() / hide ... all day without any errors).

    So, my question is two part:
    1. Does coolite have something similar to the Atlas UpdatePanel? For this simple example, the ext:Label solves the problem (minus the script error) ... but for any real control, coolite can't possibly have every control I might use (since some might even be custom).

    2. Am I missing something obvious, or doing this the wrong way?


    For reference, here is some code:
    <U>Test.aspx</U>
    <%@ Register src="TestCtrl.ascx" tagname="TestCtrl" tagprefix="uc1" %>
    .
    .
    .
            <ext:Button ID="ShowAjax1" runat="server" Text="ShowAjax1">
               <AjaxEvents>
                    <Click OnEvent="OnShowAjax1"></Click>
                </AjaxEvents>
            </ext:Button><br />
            <ext:Button ID="ShowAjax2" runat="server" Text="ShowAjax2">
               <AjaxEvents>
                    <Click OnEvent="OnShowAjax2"></Click>
                </AjaxEvents>
            </ext:Button><br />
    
            <ext:Window ID="Window1" runat="server" Icon="Application" Title="Some Title" 
                Modal="True" Show&#111;nload="False" Shadow="Frame" Resizable="False" ResizeHandles="none" 
                ConstrainHeader="True" Plain="False" ShadowOffset="8" 
                Width="750px" Center&#111;nload="True" BodyBorder="False" HideBorders="True"
                Draggable="False" AutoHeight="True" CloseAction="Close">
                <Body>
                    <uc1:TestCtrl ID="Test1" runat="server" />
                </Body>
            </ext:Window>
    <U>Test.aspx.cs
    </U>
    ...
            protected void OnShowAjax1(object sender, AjaxEventArgs e)
            {
                Test1.SiteID = "Ajax1";
                Test1.EditMode = true;
                Window1.Show(ShowAjax1);
            }
    
    
            protected void OnShowAjax2(object sender, AjaxEventArgs e)
            {
                Test1.SiteID = "Ajax2";
                Test1.EditMode = false;
                Window1.Show(ShowAjax2);
            }
    ...
    <U>TestCtrl.ascx</U>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><br />
    <%-- Uncomment the next line (and the match line in the .cs) for a JS error --%>
    <%-- <ext:Label ID="Label2" runat="server"></ext:Label> --%>
    <U>TestCtrl.ascx.cs
    </U>
        public partial class TestCtrl : System.Web.UI.UserControl
        {
            public string SiteID { get; set; }
            public bool EditMode { get; set; }
    
    
            protected override void OnPreRender(EventArgs e)
            {
                if(EditMode)
                {
                    Label1.Text = "Edit " + SiteID;
                }
                else
                {
                    Label1.Text = "Add " + SiteID;
                }
    
    
                // Label2.Text = Label1.Text;
            }
        }
  2. #2

    RE: Updating a window's content during an ajax callback (and showing)

    The show/hide/show script error was because I had Close="close" instead of Close="hide"...

    Now, my question is really just: Does coolite have something similar to the Atlas UpdatePanel or do I have to use only controls from coolite?

Similar Threads

  1. [CLOSED] Updating window content
    By borja_cic in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 15, 2011, 6:04 PM
  2. ajax request failure callback function help
    By [WP]joju in forum 1.x Help
    Replies: 1
    Last Post: Apr 30, 2010, 9:52 AM
  3. [CLOSED] Closing a window from within AJAX loaded content
    By pschojer in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 26, 2009, 9:06 AM
  4. How to update a asp.net gridview in ajax callback?
    By tangcan2003 in forum 1.x Help
    Replies: 1
    Last Post: Mar 04, 2009, 11:12 PM
  5. ASP.NET AJAX CallBack
    By tonymayoral in forum 1.x Help
    Replies: 2
    Last Post: Feb 07, 2009, 11:37 PM

Posting Permissions