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

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

3 Answers 36 Views
LightBox
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 03 Mar 2014, 01:48 PM
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>

3 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 06 Mar 2014, 09:24 AM
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!

0
Daniel
Top achievements
Rank 1
answered on 06 Mar 2014, 01:40 PM
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.



0
Daniel
Top achievements
Rank 1
answered on 10 Mar 2014, 08:47 AM
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
Tags
LightBox
Asked by
Daniel
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Daniel
Top achievements
Rank 1
Share this question
or