[CLOSED] TaskManager in combination with ASP postback in a UpdatePanel

  1. #1

    [CLOSED] TaskManager in combination with ASP postback in a UpdatePanel

    When combining a ext:TaskManger with another standard ASP postback within a UpdatePanel causes an error in an Ext component. At first we thought this was only in combination with a asp:Timer however it's also in combination with a asp:Button so I'm supposing it's always with an ASP postback


    When the ASP postback fires, in Visual Studio 2008 you'll get an error "Microsoft JScript runtime error: Object doesn't support this property or method". The debuggers breaks on a line in the xhml file. When we Continue running the project the Ext controls have disappeared.


    Note, that when you remove the asp:UpdatePanel, the script works again, only the TaskManager looses it's state (counter starts counting again from the position it was).


    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="TestTool.Content.Test" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title></title>
    </head>
    <body>
    	<script runat="server">
    		protected void ruinScript_Tick( object sender , EventArgs e )
    		{
    			resultOfTheRuination.Text = "The Ext controls are on vacation now";
    		}
    
    
    		protected void manualRuination_Click( object sender , EventArgs e )
    		{
    			resultOfTheRuination.Text = "I sent the Ext controls on vacation, happy holidays!";
    		}
    
    
    		protected void countTask_Update( object sender , AjaxEventArgs e )
    		{
    			Int32 changes = Convert.ToInt32( hiddenCounter.Text );
    			changes++;
    			if ( changes == 1 )
    			{
    				resultLabel.Text = "First time change";
    			}
    			else if ( changes == 5 )
    			{
    				resultLabel.Text = "Last change (5)";
    				ScriptManager2.AddScript( "{0}.stopTask('countTask');" , TaskManager1.ClientID );
    			}
    			else
    			{
    				resultLabel.Text = string.Format( "I've been changed {0} times" , changes );
    			}
    			hiddenCounter.Text = changes.ToString( );
    		}
    
    
    		protected void stopCounting_Click( object sender , AjaxEventArgs e )
    		{
    			ScriptManager2.AddScript( "{0}.stopTask('countTask');" , TaskManager1.ClientID );
    		}	
    	</script>
    	
        <form id="form1" runat="server">
    	<asp:ScriptManager ID="ScriptManager1" runat="server">
    	</asp:ScriptManager>
    	<ext:ScriptManager ID="ScriptManager2" runat="server">
    	</ext:ScriptManager>
        
    	
    	<asp:UpdatePanel ID="up1" runat="server" UpdateMode="Conditional">
    		<ContentTemplate>
    		
    			<ext:TaskManager ID="TaskManager1" runat="server">
    				<Tasks>
    					<ext:Task TaskID="countTask" Interval="1000" AutoRun="true">
    						<AjaxEvents>
    							<Update OnEvent="countTask_Update" />
    						</AjaxEvents>
    					</ext:Task>
    				</Tasks>
    			</ext:TaskManager>
    
    
    			<ext:Hidden ID="hiddenCounter" runat="server" Text="0" />
    			<ext:Label ID="resultLabel" runat="server" Text="Nothing set yet..." />
    			<ext:Button ID="stopCounting" runat="server" Text="Stop counting">
    				<AjaxEvents><Click OnEvent="stopCounting_Click" /></AjaxEvents>
    			</ext:Button>
    
    
    			<asp:Timer ID="ruinScript" runat="server" OnTick="ruinScript_Tick" Interval="7500" Enabled="true"></asp:Timer>
    			<asp:Button ID="manualRuination" runat="server" Text="Never press this button" &#111;nclick="manualRuination_Click"/>
    			<asp:Label ID="resultOfTheRuination" runat="server" Text="Everyting ok" />
    			
    		</ContentTemplate>
    	</asp:UpdatePanel>	
    		
        
    
      </form>
    </body>
    </html>
  2. #2

    RE: [CLOSED] TaskManager in combination with ASP postback in a UpdatePanel

    ... ignore this, just to get updates about this topic :-)
  3. #3

    RE: [CLOSED] TaskManager in combination with ASP postback in a UpdatePanel

    Hi,

    What the reason to put TaskManager inside UpdatePanel? If you move TaskManager outside UpdatePanel then your example works fine (just I think need to add ViewStateMode="Include" to the Update ajax event of Task).


    I think that TaskManager is incompatible with UpdatePanel now. I am not sure on 100% why but I think that exception may occurs because TaskManager use timer for task and pass own reference to the timer task. When update panel is refreshed then TaskManager is recreated (destroy and create new instance)


    I can't imagine what should be a reason to have TaskManager inside UpdatePanel. Does application's logic allow to move TaskManager outside UpdatePanel?
  4. #4

    RE: [CLOSED] TaskManager in combination with ASP postback in a UpdatePanel

    Hi,

    The example above was simpified so we've integrated everything in one page. We're using user controls that are nested in another page using asp controls like update panels. So if we include the usercontrol containing a task manager into an aspx page (or even another user control), that uses update panels we're stuck.

    The only reason we're using the task manager is to retrieve a ajax callback when the page loads so we can async load some gridpanels. If there are other ways, please let us know. For now we will try to get rid of the asp update panels.

    regards

Similar Threads

  1. Ext.NET and Ribbon combination
    By UserClarion in forum 1.x Help
    Replies: 6
    Last Post: May 28, 2012, 1:05 PM
  2. Replies: 2
    Last Post: Mar 28, 2012, 9:13 AM
  3. Replies: 0
    Last Post: Mar 19, 2012, 3:56 PM
  4. [CLOSED] Drag does not function after postback to UpdatePanel
    By IT1333 in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Oct 28, 2011, 4:04 PM
  5. Replies: 1
    Last Post: Jun 04, 2008, 10:28 PM

Posting Permissions