This is a migrated thread and some comments may be shown as answers.

Can we do Load on Demand without Webservice?

4 Answers 61 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
Vijaianand
Top achievements
Rank 1
Vijaianand asked on 28 Dec 2011, 10:57 PM
My requirement is to load only certain item initially and load on every pagination like radgrid Ajax previous or next event. I don't see any example. All load on demand is through webservice which I am trying to avoid. I have datatable bind for the rotator and trying to load only few items and then load on every request. Is it possible?

4 Answers, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 03 Jan 2012, 11:09 AM
Hello,

In case you don't want to load on demand the items of the RadRotator via a WebService, I would suggest using the control's client-side method addRotatorItem, which will allow you to create and add  new items to the RadRotator's client-side item collection. The example below demonstrates how to utilize the mentioned method in order to add a new item at the end of the collection:
var rotator = $find("<%=RadRotator1.ClientID %>");
var radRotatorItemData = [];
radRotatorItemData.Html = "<div>Item's content</div>";
rotator.addRotatorItem(radRotatorItemData);

You can use the RadRotator's client events OnClientItemShowing and OnClientItemShown to implement the loading of the new items at the desired moment during the sliding of the control.

If your scenario includes removing the items of the RadRotator on the client, the following function will help you achieve this:
function RemoveAllItems() {
    var rotator = $find("<%=RadRotator1.ClientID %>");
 
    var container = rotator.get_containerElement();
 
    var items = rotator.get_items();
    while (items.length) {
        var item = items.pop();
        container.removeChild(item.get_element());
    }
 
    var zeroBounds = new Sys.UI.Bounds(0, 0, 0, 0);
    $telerik.setBounds(rotator._itemsElement, zeroBounds);
}

Note that in the examples above I have referenced a rotator control with ID, set to RadRotator1, which may be different in your case.

I hope the provided information will help you incorporate the desired feature into your actual project.

Regards,
Slav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Vijaianand
Top achievements
Rank 1
answered on 06 Jan 2012, 04:26 PM
I want something in the server side code via ajax or something.
0
Slav
Telerik team
answered on 10 Jan 2012, 05:55 PM
Hello,

If you want to populate the items of a RadRotator on the server via Ajax, you can place the RadRotator control inside an UpdatePanel and when an Ajax request is sent, you can rebind the datasource of the rotator control in order to include new items in its collection. I have prepared a sample project that demonstrates this approach. Please use it as a reference for your future development.

Kind regards,
Slav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Vijaianand
Top achievements
Rank 1
answered on 11 Jan 2012, 03:21 PM
Thanks. I will check it out.
Tags
Rotator
Asked by
Vijaianand
Top achievements
Rank 1
Answers by
Slav
Telerik team
Vijaianand
Top achievements
Rank 1
Share this question
or