ajaxRequest problem

6 posts, 1 answers
  1. JC Wu
    JC Wu avatar
    15 posts
    Member since:
    Dec 2009

    Posted 27 Jan 2010 Link to this post

    In my dnn web site,I have two modules.
    moduleA : Client side will call ajaxmanager.ajaxRequest or ajaxmanager.ajaxRequestWithTarget function to refresh some information in server side.
    moduleB : There is a RadAjaxPanel.
    When moduleA raises an ajaxRequest, at the same time moduleB does some action to trigge RadAjaxPanel.
    In this situation, both moduleA and moduleB stop working(server side function cannot complete).
    moduleA's Server side event
            protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)  
            {  
                AddMsg(HiddenMsg.Value);  
            }  
              
            protected void RadRotator1_Load(object sender, EventArgs e)  
            {  
                AddMsg(HiddenMsg.Value);  
            } 
    moduleA's javascript
            function SuccessHandler(message) {  
                try 
                {  
                    var hidden = document.getElementById("<%=HiddenMsg.ClientID %>");  
                    hidden.value= message;  
                    ajaxManager.ajaxRequestWithTarget("<%=RadRotator1.UniqueID %>",'');  
                      
                    //ajaxManager.ajaxRequest(message);  
                      
                }  
                catch (e)  
                {  
                }  
            } 
  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 02 Feb 2010 Link to this post

    Hello,

    Could you please try sending the both modules code (ascx, cs/vb) so we could try replicating the issue locally based on your scenario and setup?

    Looking forward your replies,
    Iana
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  3. JC Wu
    JC Wu avatar
    15 posts
    Member since:
    Dec 2009

    Posted 02 Feb 2010 Link to this post

    There is a sample to show this problem.
    Situation 1
    Setp 1 : Click module1's button
    Setp 2 : When module1 is still running,click module2's button
    module1's label.Text will not change

    Situation 2
    Setp 1 : Click module2's button
    Setp 2 : When module2 is still running,click module1's button
    module2's label.Text will not change

    Module1 ascx
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="DesktopModules_Module1_WebUserControl" %> 
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
     
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
        <script type="text/javascript">     
         
            var ajaxManager = null
            var count = 0
             
            function RaiseAjax() { 
                ajaxManager.ajaxRequest(count); 
                count++; 
            } 
     
            function pageLoad() { 
                if (ajaxManager == null) { 
                    ajaxManager = $find("<%=RadAjaxManager.GetCurrent(Page).ClientID%>"); 
                } 
            } 
        </script> 
    </telerik:RadCodeBlock> 
     
    <asp:Label ID="Label1" runat="server"></asp:Label> 
    <input id="Button1" type="button" value="button" onclick="RaiseAjax()" /><telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server"  
        Skin="Default"
    </telerik:RadAjaxLoadingPanel> 
    Module1 cs
    using System; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Web; 
    using System.Web.UI; 
    using System.Web.UI.WebControls; 
    using DotNetNuke.Entities.Modules; 
    using Telerik.Web.UI; 
     
    public partial class DesktopModules_Module1_WebUserControl : PortalModuleBase 
        protected override void OnInit(EventArgs e) 
        { 
            if (RadAjaxManager.GetCurrent(this.Page) == null
            { 
                RadAjaxManager radAjaxManager1 = new RadAjaxManager(); 
                radAjaxManager1.ID = "RadAjaxManager1"
                this.Page.Form.Controls.Add(radAjaxManager1); 
            } 
            base.OnInit(e); 
        } 
     
        protected void Page_Load(object sender, EventArgs e) 
        { 
            RadAjaxManager manager = RadAjaxManager.GetCurrent(this.Page); 
            if (manager != null
            { 
                manager.DefaultLoadingPanelID = RadAjaxLoadingPanel1.ID; 
                manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(manager_AjaxRequest); 
                manager.AjaxSettings.AddAjaxSetting(manager, Label1); 
            } 
        } 
     
        void manager_AjaxRequest(object sender, AjaxRequestEventArgs e) 
        { 
            System.Threading.Thread.Sleep(2000); 
            Label1.Text = e.Argument; 
        } 
    Module2 ascx
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="DesktopModules_Module2_WebUserControl" %> 
    <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" height="200px"  
        HorizontalAlign="NotSet" LoadingPanelID="RadAjaxLoadingPanel1" width="300px"
        <asp:Label ID="Label1" runat="server"></asp:Label> 
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> 
    </telerik:RadAjaxPanel> 
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server"  
        Skin="Default"
    </telerik:RadAjaxLoadingPanel> 
    Module2 cs
    using System; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Web; 
    using System.Web.UI; 
    using System.Web.UI.WebControls; 
    using DotNetNuke.Entities.Modules; 
     
    public partial class DesktopModules_Module2_WebUserControl : PortalModuleBase 
        protected void Page_Load(object sender, EventArgs e) 
        { 
     
        } 
        protected void Button1_Click(object sender, EventArgs e) 
        { 
            System.Threading.Thread.Sleep(3000); 
            Label1.Text = DateTime.Now.ToLongTimeString(); 
        } 

  4. rubenhak
    rubenhak avatar
    58 posts
    Member since:
    Dec 2008

    Posted 03 Feb 2010 Link to this post

    Hi,

    I'm having a similar problem. If you make ajaxrequest calls too quickly some of the requests will be missed. for example if you try
    ajaxManager.ajaxRequest('a'); 
    ajaxManager.ajaxRequest('b'); 
    you will not receive the ajaxRequest for 'a'. Is there any way to fix it?

    Thanks,
    Ruben.
  5. Answer
    Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 08 Feb 2010 Link to this post

    Hello,

    For Ruben's question: To overcome the issue in your case, please try setting the RadAjaxManager RequestQueueSize property as described here.

    As it is to the JC Wu scenario: I used the provided code in a sample project and was abe to replicate the described behavior. What happens in the case where you invoke multiple ajax requests, is that only the last one is executed properly and the previously invoked ones are aborted. 
    However, if you want to allow the user to invoke multiple ajax requests at a time, I suggest you to use RadAjaxManager in all the modules and set the RequestQueueSize property as described above.


    Regards,
    Iana
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  6. rubenhak
    rubenhak avatar
    58 posts
    Member since:
    Dec 2008

    Posted 08 Feb 2010 Link to this post

    Hi Iana,

    It works.

    Thank you,
    Ruben.
Back to Top