Can we do Load on Demand without Webservice?

5 posts, 0 answers
  1. Vijaianand
    Vijaianand avatar
    82 posts
    Member since:
    Jul 2012

    Posted 28 Dec 2011 Link to this post

    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?
  2. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 03 Jan 2012 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Vijaianand
    Vijaianand avatar
    82 posts
    Member since:
    Jul 2012

    Posted 06 Jan 2012 Link to this post

    I want something in the server side code via ajax or something.
  5. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 10 Jan 2012 Link to this post

    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
  6. Vijaianand
    Vijaianand avatar
    82 posts
    Member since:
    Jul 2012

    Posted 11 Jan 2012 Link to this post

    Thanks. I will check it out.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017