Error on paging 1st image. (index 0);

4 posts, 0 answers
  1. Daniel
    Daniel avatar
    34 posts
    Member since:
    Feb 2011

    Posted 03 Mar 2014 Link to this post

    Hello

    We are working on adding images to a RadLighbox.  The images are all related to a single service ticket, but each note has it's own images directory.  

    We are adding the images by looking through the images located and adding them.

     foreach (FileInfo image in images)
     {
            lightBoxItem = new RadLightBoxItem();
            lightBoxItem.ImageUrl = String.Format("{0}/{1}", pixPath, image.Name);
            lightBoxItem.Title = image.Name;
            RadLightBox1.Items.Add(lightBoxItem);                       
     }

    Now, in the databind of the notes grid, we have thumnails for each image.  We wrap a hyperlink around each thumnail and wire it up to the image in the lightbox to be opened by a js call  (i = the index of the image


     HyperLink hlnkImage = new HyperLink();
                                        hlnkImage.ID = "hlnkImage" + i.ToString();
                                        hlnkImage.SkinID = "hlnkImage";
                                        hlnkImage.ImageUrl = String.Format("{0}/Thumbnails/{1}", pixPath, image.Name);
                                        hlnkImage.ToolTip = image.Name;
                                        hlnkImage.Attributes.Add("onclick", String.Format("OpenRadLigthBox('{0}'); return false", i));

                                        divImageContainer.Controls.Add(hlnkImage);
                                        divInner.Controls.Add(divImageContainer);
                                        divOuter.Controls.Add(divInner);

    This all works as expected EXCEPT.  If we click on the hyperlink that corresponds to the first image (index 0), the image opens in the lightbox, but when we try to page, it errors out and the lightbox is then frozen.  If we open any other image first, all works well, even the first image after paging to it.
    Here is the js error

    0x800a138f - JavaScript runtime error: Unable to get property '_get_hasTemplate' of undefined or null reference

    Lastly here is the declarative ligthbox in the ascx page

    <telerik:RadLightBox ID="RadLightBox1" runat="server" Modal="true" AppendDataBoundItems="true" RenderMode="Lightweight" LoopItems="true">
        <ClientSettings AllowKeyboardNavigation="true" NavigationMode="Button" ShowItemsCounter="false">
            <AnimationSettings HideAnimation="Resize" NextAnimation="Resize" PrevAnimation="Resize" ShowAnimation="Resize" />
        </ClientSettings>
    </telerik:RadLightBox>
  2. Kostadin
    Admin
    Kostadin avatar
    1708 posts

    Posted 06 Mar 2014 Link to this post

    Hi Daniel,

    I was unable to replicate the issue on my side. I prepared a small sample similar to your scenario and attached it to this forum thread. Please give it a try and let me know how it differs from your real setup.

    Regards,
    Kostadin
    Telerik

    DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Daniel
    Daniel avatar
    34 posts
    Member since:
    Feb 2011

    Posted 06 Mar 2014 Link to this post

    I don't see any differences that would make a difference.  There are a couple subtle difference... you project does not load index 0 (but I made the necessary changes and it does not create the error that mine does.

    For now, my workaround is to hide the prev/next controls and eliminate paging.  It is not the ideal solution, but prevents the page from breaking.

    Here is a screenshot of my js error, in case it sparks a thought.



  5. Daniel
    Daniel avatar
    34 posts
    Member since:
    Feb 2011

    Posted 10 Mar 2014 in reply to Kostadin Link to this post

    I have not been able to reconcile the difference between your implementation and mine.  The Lightbox is implemented in the same basic manner... of course the devil is in the details of the actual page.  

    For now I have disabled paging and will circle back to this when we have more time
Back to Top