Loading images dynamically

3 posts, 0 answers
  1. Mark
    Mark avatar
    2 posts
    Member since:
    Jun 2014

    Posted 11 Jun 2014 Link to this post

    Do you have an example of how to pass in an argument (for example an image name) from a javascript function to a radlightbox when it opens?  I want to do something like the below, where the onmouseover in the <img src opens the lightbox if I hard code the value in the <asp:Image.
    I need to load different images on different img src tags so I thought passing the image name via the funcion was the cleanest way to do so. 

    Is this the best way to do this:

    The disadvantage is that it looks like every image is loaded when the page is rendered, I was hoping it load the image dynamically.
    Thanks for your help!

    <script type="" >
    function loadlb(imageName) {
            var rbx = $find('<%= rlbBox.ClientID %>');

    <telerik:RadLightBox Modal="true" RenderMode="Auto" ClientIDMode="Static" ID="rlbBox" runat="server" ShowCloseButton="true">
    <asp:Image runat="server" ImageUrl="<image_from_loadlb>"/> 

    <img src=<some image> onmouseover="loadlb('imageToLoad'.jpg')" >
  2. Kostadin
    Kostadin avatar
    1733 posts

    Posted 16 Jun 2014 Link to this post

    Hi Mark,

    The approach in the provided forum thread refers only when you are using a template. If you want to display an image you could either load all image in the LightBox control and use the set_currentItemIndex(index) method to point to the image which needs to be shown or load the image dynamically as demonstrated in the following help article.


    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.

  3. mack
    mack avatar
    1 posts
    Member since:
    Jun 2016

    Posted 27 Jun 2016 Link to this post

    Hi mark check this useful article.I hope it will solve your problem




Back to Top