New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Lazy Load Images

RadListBox now supports lazy loading of images to improve performance when many items have images.

You can enable the functionality by setting the EnableImageLazyLoading property to true. When enabled, images are loaded only when items scroll into the visible area, significantly reducing initial page load time for lists with many images.

When image lazy loading is turned on, RadListBox will render images with a data-src attribute instead of src. As items enter the viewport, their images are activated automatically using an IntersectionObserver (with a scroll-based fallback for older browsers). A 50px margin is used to preload images just before they become visible, ensuring a smooth scrolling experience.

Image lazy loading works with both statically declared items and dynamically added items. It is also compatible with the existing Load on Demand feature - images within newly loaded batches are automatically observed and loaded as they scroll into view.

Lazy loading is triggered in the following scenarios:

  • Initial render - only images in the visible viewport (plus a 50px buffer) are loaded on page load.
  • Scroll - as the user scrolls, images entering the viewport are loaded on demand.
  • Dynamically added items - items added via client-side API or Load on Demand callbacks automatically participate in lazy loading.
  • DefaultVB.aspx
  • DefaultVB.aspx.vb
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="DefaultVB.aspx.vb"  Inherits="ListBox_Examples_Functionality_LazyLoadImages_DefaultVB" %>

<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-containers">
        <div class="demo-container size-thin">
            <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" />
            <telerik:RadListBox runat="server" ID="RadListBox1" Height="200px" Width="300px" EnableImageLazyLoading="true" LoadingPanelID="<%# RadAjaxLoadingPanel1.ClientID %>" />
        </div>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance