Load docks asynchronously

23 posts, 0 answers
  1. apb
    apb avatar
    46 posts
    Member since:
    Nov 2008

    Posted 14 Apr 2009 Link to this post

    Hi,

    I have a portal-type page that can contain any number of "portlets". Various types of portlets get data from various sources like RSS feeds, database queries, etc. Some of them are fast, others slow, depending on how much work they have to do to get their data.

    So that one or two slow-loading docks do not slow down the entire page, what I am looking to do is:
        1. have the main page and its collection of docks load immediately
        2. but then for each dock to then independently begin acquiring its data, displaying a loading panel  as it does its work
        3. do this in a way that won't cause javascript errors if a dock is closed or minimized while "loading" or page navigation occurs, etc.
     
    I've searched around (both on these forums and Google), but cannot find clear instructions anywhere that shows how to get RadDocks to do the above.

    Thanks for any assistance you can provide.

    -Al

  2. Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts

    Posted 16 Apr 2009 Link to this post

    Hello apb,

    To achieve this you should load the RadDock's content via WebService. I created for you a simple example which illustrates how this could be done - please find it attached.

    All the best,
    Petio Petkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Martin
    Martin avatar
    84 posts
    Member since:
    Apr 2009

    Posted 27 Apr 2009 Link to this post

    This does not really act asynchronously. Good test for this is to add random sleep thread inside the web service. You will notice that basically the docks load in sequence and if a dock takes a while to load the whole batch waits.
  5. Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts

    Posted 29 Apr 2009 Link to this post

    Hello Martin,

    The previous example was provided to show how to use RadDock with WebService. I modified the example to use more than one WebService and you will see that they are loaded asynchronously. Please find it attached.

    All the best,
    Petio Petkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. apb
    apb avatar
    46 posts
    Member since:
    Nov 2008

    Posted 29 Apr 2009 Link to this post

    Hi Petio,

    Thanks for your response, but I'm confused.  What does using a web service have to do with asynchronous loading? 

    Basically what is needed is for the dock control to be able to refresh it's contents via AJAX, plus a way to tell it to do so.

    For instance, suppose the dock knew it that it would contain a user control that implemented an IPortlet interface. The IPortlet interface exposes a method called Load(). This would allow a page full of portlets to load without doing any of the heavy-lifting, deferring that until they are told to invoke their controls' Load() methods.  

    So what is needed would seem to be:

    1. A way for docks/portlets to register themselves (or be registered) as they are loaded onto the page so that they can all be informed when the page is loaded and it is time for them to get their contents. Or, maybe even more simply, just a way to tell the docks/portlets to do something via javascript.

    2. Then, once the page is loaded, some event (body onload, maybe?) can instruct the portlets to invoke the Load() methods of the controls they contain.

    So my my real question is how, using the various bits of Telerik plumbing, do I go about this?

    -Al
  7. Martin
    Martin avatar
    84 posts
    Member since:
    Apr 2009

    Posted 29 Apr 2009 Link to this post

    I will try the new code tomorrow, I will let you know Petio. With those docks ideally this should happen:
    let's say you have 4 docks.... 1, 2, 3, 4
    docs 1 and 3 load the same process,
    2 loads a complex report from DB
    4 loads a simple report from DB

    so ideally. 1 and 3 will load first at the same time, then 4, then 2 at the end.
  8. Martin
    Martin avatar
    84 posts
    Member since:
    Apr 2009

    Posted 19 May 2009 Link to this post

    The new code works asynchronously like a charm, thanks Petio.
    One thing, guys when you give the code, please include the complete solution. At this to run code samples we need to create new project and drag and drop files into it, sometimes with no success.
    Thanks
  9. EJJ
    EJJ avatar
    2 posts
    Member since:
    Nov 2008

    Posted 15 Jun 2009 Link to this post

    Hi,

    In the webservice1.zip --> MyWebService.cs file --> RenderView method, what happens if the UserControl that is dynamically loaded contains a RadGrid control that expects an AJAX ScriptManager on the page that is loading it?  In our experiments, we run into the error "The control with ID 'rg' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.
    " (where rg is a RadGrid).

    We have only been able to circumvent this error by first programmatically adding an HtmlForm object to the "rendering page" instantiated in the WebService, then adding a ScriptManager object to the form, then adding the dynamically loaded UserControl to the form.  Unfortunately, this has the consequence of generating HTML output for more than just the UserControl (which is the only thing we want to render and return to the calling RadDock via the WebService).

    Do you have any suggestions, other than parsing the page HTML output to obtain only the HTML for the UserControl with the RadGrid (which ultimately, I'm not sure of how this would work anyway, since the UserControl loaded into the RadDock would eventually need to be able to interact with the ScriptManager on the page that called the WebService to load the control into the RadDock, and not the ScriptManager that was added to the "rendering page" executed in the WebService to generate the control output) ?

    Please let me know if my description of the problem is not clear.

    Thanks for your assistance,
    Eric

  10. Petko
    Admin
    Petko avatar
    45 posts

    Posted 18 Jun 2009 Link to this post

    Hi,

    I ran the project "webservice1.zip" attached by Petio Petkov, but I was not able to reproduce the problem and did not get such an error. I added RadColorPicker instead of RadGrid in the user control and set its property RegisterWithScriptManager to "false". Everything worked fine on my side!

    My recommendation is to try this approach, but if the problem still persists, please, send us detailed information about your test case and if possible open a support ticket and send us a sample working project, where we can observe the issue. Once we receive the necessary information, we will do our best to provide a solution.

    Best regards,
    Petko
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  11. Martin
    Martin avatar
    84 posts
    Member since:
    Apr 2009

    Posted 18 Jun 2009 Link to this post

    On our end we also do not have ScriptManager on the user control and we get no error.
    You should try to run that example as it is, just to make sure all your plumbing is working fine.
  12. EJJ
    EJJ avatar
    2 posts
    Member since:
    Nov 2008

    Posted 22 Jun 2009 Link to this post

    Thank you for your responses.  We were using the 2009.1.311.20 version of the RadControls for ASP.NET AJAX assembly, so we did not see the "RegisterWithScriptManager" property on any of the controls.

    After some time and research, we realized that we needed to download version 2009.1.527.20 of the assembly in order to use the property you recommended.

    Now, almost everything is working correctly, except for the user controls that contain RadMultiPage controls.  The RadMultiPage does not seem to expose a "RegisterWithScriptManager" property, and neither does the RadPageView.  Is it possible to use this method of loading user controls into docks asynchronously if they contain RadMultiPage?  Do you have any further suggestions to solve this problem?  Also, are there any other RadControls that do not expose this property?

    Thanks again for your assistance,
    Eric
  13. Martin
    Martin avatar
    84 posts
    Member since:
    Apr 2009

    Posted 23 Jun 2009 Link to this post

    that is the same version we are using.
    the problem you are facing has nothing to do with Telerik.
    to be able to support Ajax you need to put the following in your code

     

     


    <
    asp:ScriptManager ID="ScriptManager1" runat="server">

     

     

    </asp:ScriptManager>

    then to make web service call do something like this

     

    PageMethods.[your server side function name](parameters,

    CallSuccess, CallFailure, JSParameters);

    on server side you need something like this so your AJAX can call it

     

    [System.Web.Services.

    WebMethod]

     

     

    public static string your server side function name(string some_variable)

     

    {

     

    //do some work;

     

     

    return some_result;

     

    }

     


     

  14. Dheeraj Ramaswamy
    Dheeraj Ramaswamy avatar
    15 posts
    Member since:
    Jun 2008

    Posted 24 Jul 2009 Link to this post

    I dont know if Al original question was answered but I have been trying to do the same as Al wants. Was this answered?
  15. apb
    apb avatar
    46 posts
    Member since:
    Nov 2008

    Posted 25 Jul 2009 Link to this post

    No, I was never able to get it working in real-world scenarios. I'm hoping the new RadXmlHttpPanel will provide better options.

    I (and I suspect everyone else using docks) would like to see a semi-realistic RadXmlHttpPanel example using:

    1. Docks created dynamically in code-behind.
    2. Docks able to contain interactive user controls (controls that post back and update themselves)
    3. Dock custom commands should be able to communicate with thier own contents (say by telling it to refresh itself)
    4. Non-content-related dock actions like moving, min/max, closing should not cause any of the dock content controls to postback.
    5. A postback by any of the individual docks should not cause the page or other docks to postback.
    6. An ajax or regular postback by the page should not cause any dock or dock-content state to be lost.
    7. Should support multiple simultaneous requests (avoid ajax single-request limitation - Telerik ajax request queing doens't seem to work very well).

    In numerous attempts I've been able to get various subsets of the above working, but never all at once.

    -Al
  16. Dheeraj Ramaswamy
    Dheeraj Ramaswamy avatar
    15 posts
    Member since:
    Jun 2008

    Posted 25 Jul 2009 Link to this post

    Hi ,

    Thanks for your reply. Pretty much I have the same requirements and will try to see if the new xmlhttpupdatepanel helps me. However I believe the link below is what I had been researching with, might help you solve your needs. 

    http://www.codeproject.com/KB/ajax/PartialUpdatePanel.aspx
  17. apb
    apb avatar
    46 posts
    Member since:
    Nov 2008

    Posted 25 Jul 2009 Link to this post

    Thanks for the link. Looks interesting. Even has an auto-update feature that some of my users are requesting. 

    Guess the main issue will be if it plays well with Telerik docks...

    -Al
  18. Victor Campos
    Victor Campos avatar
    17 posts
    Member since:
    Apr 2009

    Posted 09 Nov 2009 Link to this post

    Loading ASCX's in an async manner is explained thoroughly in this articles:
     
    http://msdn.microsoft.com/en-us/magazine/cc163725.aspx
    http://msdn.microsoft.com/en-us/magazine/cc163725.aspx

    this is by far my favorite article: http://markitup.com/Posts/Post.aspx?postId=1fded0e9-e871-4e4a-a419-c1a770174cf1

    Hope it helps!
  19. apb
    apb avatar
    46 posts
    Member since:
    Nov 2008

    Posted 10 Nov 2009 Link to this post

    Hi Victor,

    Thanks for the links. They don't address exactly what I am trying to do, but are a good technique anyway for a page that must do multiple things that may be time-consuming.

    BTW, I think the link here is also helpful in fully understanding page-level async processing:
    http://msdn.microsoft.com/en-us/magazine/cc163587.aspx

    -Al
  20. Victor Campos
    Victor Campos avatar
    17 posts
    Member since:
    Apr 2009

    Posted 10 Nov 2009 Link to this post

    Excellent!  I have a pdf version of this article but I couldn't find the link to save my life...  I'll save the link.

    Thanks again!
  21. Kishan Gandikota
    Kishan Gandikota avatar
    44 posts
    Member since:
    Sep 2009

    Posted 08 Feb 2012 Link to this post

    Hi apb,

    I am exactly running in to same requirement as yours. Just wondering if you were able to achieve this using raddocks. Any comments/guidance would be appreciated.

    Regards,
    Kishan G K
  22. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 13 Feb 2012 Link to this post

    Hi Kishan,

    Please note that at the beginning of the thread there is a sample project, which demonstrates the requested approach. I would suggest checking if it will help you achieve the desired functionality, in case you haven't done so already.

    Regards,
    Slav
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  23. Ryan
    Ryan avatar
    2 posts
    Member since:
    Aug 2013

    Posted 05 Nov 2014 Link to this post

    Is there an example similar to the webservice1 example that shows interactive docks? Such as one containing a radgrid or an updatepanel etc? 
  24. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 10 Nov 2014 Link to this post

    Hello Ryan,

    There is no such example, however using a standard web service call will not allow you to load server controls in the RadDock controls. The best approach to do so is via UpdatePanel controls, nevertheless in this case it will not be possible to initiate simultaneous requests to the server, which means that you will have to load the content in the docks sequentially.

    You can also try the RadXmlHttpPanel controls: http://demos.telerik.com/aspnet-ajax/xmlhttppanel/examples/overview/defaultcs.aspx. Note that when you use callback or web service call to load data via this control not all page life cycle events are raised, so some controls may not work correctly in this case. This is why UpdatePanel, RadAjaxManager or RadAjaxPanel are more suitable to load dynamic page content that requires server-side interactions.

    Regards,
    Slav
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017