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
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.
22 Answers, 1 is accepted
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,
the Telerik team
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,
the Telerik team
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:
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?
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.
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.
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,
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.
the Telerik team
You should try to run that example as it is, just to make sure all your plumbing is working fine.
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,
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">
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
public static string your server side function name(string some_variable)
//do some work;
I (and I suspect everyone else using docks) would like to see a semi-realistic RadXmlHttpPanel example using:
- Docks created dynamically in code-behind.
- Docks able to contain interactive user controls (controls that post back and update themselves)
- Dock custom commands should be able to communicate with thier own contents (say by telling it to refresh itself)
- Non-content-related dock actions like moving, min/max, closing should not cause any of the dock content controls to postback.
- A postback by any of the individual docks should not cause the page or other docks to postback.
- An ajax or regular postback by the page should not cause any dock or dock-content state to be lost.
- 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.
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.
Guess the main issue will be if it plays well with Telerik docks...
this is by far my favorite article: http://markitup.com/Posts/Post.aspx?postId=1fded0e9-e871-4e4a-a419-c1a770174cf1
Hope it helps!
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:
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.
Kishan G K
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.
the Telerik team
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.
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.