Avoiding unecessary RadProgressManager calls

Thread is closed for posting
8 posts, 0 answers
  1. CSurieux
    CSurieux avatar
    465 posts
    Member since:
    Jan 2007

    Posted 21 Sep 2009 Link to this post

    Hello,

    Using RadProgressManager to monitor a custom process, I would appreciate being able to start it only when necessary.
    My page works like an expert and the progress monitoring should be done only when pressing a button in last step (tab), this button doing a full postback, not an ajaxcall back.
    It works but I discovered that during all the previous ajax callback, the progress area is sending unecessary requests to its handler.
    How to supress them, using radprogress manager for last step only.
    I thought setting its 'enabled' status during a previous call, pb is that all previous steps are ajaxified, only last one is a postback.


    Thanks for help.
    CS
  2. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 23 Sep 2009 Link to this post

    Hello Christian Surieux,

    Indeed this is an issue with the RadProgressArea. Fortunately, there is a workaround. Please, paste the following code right after your script manager declaration:

    var prm = Sys.WebForms.PageRequestManager.getInstance(); 
    prm.add_beginRequest(beginRequestHandler); 
    var isInAsyncRequest; 
    var originalClientSubmit; 
     
    if (!originalClientSubmit) {  
    originalClientSubmit =  
    Telerik.Web.UI.RadProgressManager.prototype._clientSubmitHandler; 
    }  
     
    function pageLoad() { 
    isInAsyncRequest = false
    Telerik.Web.UI.RadProgressManager.prototype._clientSubmitHandler = function(e) { 
    if (!isInAsyncRequest) { 
    originalClientSubmit.apply(this, [e]); 
    function beginRequestHandler(sender, args) { 
    isInAsyncRequest = true

    It should do the job.

    Best wishes,
    Genady Sergeev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. CSurieux
    CSurieux avatar
    465 posts
    Member since:
    Jan 2007

    Posted 30 Sep 2009 Link to this post

    Hello Sergeev,

    Thanks, this make it work far better.
    But I have still a little problem an I can't see why: when for some reason my 'long process' return earlier than normally due to some error, i get an error in IE8 with this message:

    Détails de l’erreur de la page Web

    Agent utilisateur : Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; InfoPath.2; OfficeLiveConnector.1.4; OfficeLivePatch.1.3; .NET CLR 3.0.30729)
    Horodateur : Wed, 30 Sep 2009 07:54:02 UTC

    Message : 'Telerik.Web.UI.RadProgressManager.prototype' a la valeur Null ou n'est pas un objet.
    Ligne : 526
    Caractère : 9
    Code : 0
    URI : http://adnsrv20:5052/site/650/Migrate_Crm_Data.aspx?RadUrid=90bee803-7778-43b7-9846-88f0ab6ad54b

     


    There is certainly a synchronisation error in the order calls are made clientside ?

    Any idea ?

    Many thanks.

    CS
  5. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 30 Sep 2009 Link to this post

    Hi Christian Surieux,

    This error may happen when the client components haven't entirely loaded up. There are two solutions to the problem. One is to enwrap the aforementioned code in an If block that checks whether Telerik.Web.UI is null. Another option is to put the entire code in the client pageLoad function or in $(document).ready if you are using jQuery.

    Regards,
    Genady Sergeev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. CSurieux
    CSurieux avatar
    465 posts
    Member since:
    Jan 2007

    Posted 30 Sep 2009 Link to this post

    Thanks Sergeev,

    What could be an easy start documentation on JQuery ?

    One more question, I remarqued that in Telerik Poject templates you insert RadScriptmanger like this

    <

     

    form id="form1" runat="server">

     

     

    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">

     

     

    <Scripts>

     

     

    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />

     

     

    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />

     

     

    </Scripts>

     

     

    </telerik:RadScriptManager>

     


    Is there a difference and an advantage over the traditional ajax.net scriptManager ?

    Regards

    CS
  7. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 02 Oct 2009 Link to this post

    Hi Christian Surieux,

    Yes, RadScriptManager has increased performance compared to AspScriptManager. When loading a page with several controls on it, the number of these files can become very large, often resulting in a reduced page load time and increased traffic. The reason for this problem is that browsers make a separate request to the server for each of these resources. This is the way ScriptManager works, separate request for each resource. In contrast, RadScriptmanager combines the used resources to a single request. All you need is to add a RadScriptManager to your page and the javascript files get combined into a single file.

    Greetings,
    Genady Sergeev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  8. CSurieux
    CSurieux avatar
    465 posts
    Member since:
    Jan 2007

    Posted 02 Oct 2009 Link to this post

    Thanks,
    And why adding the lines to include Telerik.Web.UI.Common library, in the past I was not specifiyng them and they seem to comme automatically.
    Is there also a performance impact for this ?

    You don't answer concerning jquery, have any valuable source of information to recommand ?

    Thanks again for your time
    CS
  9. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 02 Oct 2009 Link to this post

    Hi Christian Surieux,

    The two script references are in concern with jQuery. They serve for bringing jQuery to your page in case you don't use any RadControls in it. In case you have RadControls, you can remove the script reference and access jQuery with the following:

    // assigns jQuery to the $ alias 
    var $ = $telerik.$; 
     

    Kind regards,
    Genady Sergeev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017