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

Some issues with RadLightBox

1 Answer 127 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Massimiliano asked on 03 Dec 2013, 05:03 PM
Playing a bit with the control I found some issues:
- If you use DataTitleField and DataDescriptionField and those are null in the DB (I may have some pictures with descriptions and other with just the title or maybe even some picture without both), you receive a system.nullreference exception instead of a pic with empty title/description

- If the pic is small ore the title/description is long, the image count text goes out the borders of the lightbox instead of expanding it. Screenshot here

 - When paging images inside an open LightBox with the supplied arrows, in a databound set, i receive a JS error: 
Uncaught TypeError: Cannot call method 'get_imageUrl' of undefined RadLightBoxScripts.js:270
c.RadLightBox._determineContentMode RadLightBoxScripts.js:270
c.RadLightBox._showLightBoxStructure RadLightBoxScripts.js:138
(anonymous function) RadLightBoxScripts.js:291
b.isFunction.i jQuery.js:3
r.complete jQuery.js:5
c jQuery.js:3
p.fireWith jQuery.js:3
u jQuery.js:5

- [SOLVED] Adding a RadLightBoxItem in code behind with a target control before bounding to a collection (code follows), works BUT when opening the lightbox while the total number of pics displayed in the box is correct (sums the manually inserted items + the databound item) the number of the actual opened pic is wrong it always gets 1 both if you open the manually added item and the first data bound item, something like 1 of 5 for both.
Dim lightBoxItem As New RadLightBoxItem
lightBoxItem.TargetControlID = "MainImage"
lightBoxItem.ImageUrl = LinkHelpers.GetProfilePath(profile.ProfileId) & profile.ImagePath
Dim profileImagesLightBox As RadLightBox = DirectCast(EvaForm.FindControl("ProfileImagesLightbox"), RadLightBox)

in aspx (that's inside a formview inside a user control nested in a radgrid..)
    <legend>5. Foto</legend>
    <dl class="dl-horizontal">
        <dt><%#: If(Not String.IsNullOrWhiteSpace(Item.ImageDescription), Item.ImageDescription, "Foto")  %></dt>
            <div class="profile-photo">
                <asp:PlaceHolder runat="server" Visible='<%# Not (String.IsNullOrWhiteSpace(Item.ImagePath)) %>'>
                    <asp:image runat="server" ID="MainImage" ImageUrl='<%# LinkHelpers.GetProfilePath(Item.ProfileId) & "t2-" & Item.ImagePath %>' CssClass="img-polaroid" />
    <dl class="dl-horizontal">
        <dt>Altre foto</dt>
            <telerik:RadLightBox ID="ProfileImagesLightbox" runat="server" DataImageUrlField="ImagePath" Modal="true" AppendDataBoundItems="true" TabIndex="101">
                <ClientSettings AllowKeyboardNavigation="true" NavigationMode="Zone">
                    <AnimationSettings HideAnimation="None" NextAnimation="Resize" PrevAnimation="Resize" ShowAnimation="Resize" />
            <asp:Repeater runat="server" ID="ProfileImages" ItemType="Eva.Entities.EvaProfileImage">
                    <a href="<%# LinkHelpers.GetProfilePath(Item.ProfileId) & Item.ImagePath%>" onclick="return false;"><img style="display: inline;"  onclick="OpenRadLigthBox(<%# Container.ItemIndex %>, '<%= EvaForm.FindControl("ProfileImagesLightbox").ClientID %>');
                         return false;" class="media-object img-polaroid" src='<%# LinkHelpers.GetProfilePath(Item.ProfileId) & "t1-" & Item.ImagePath%>' /></a>

Here is the result: screenshot here with the bigger pic wich is inserted "manually" in code behind (since it comes from another db table) and the smaller pics are databound (always in code behind with custom data-binding)
[SOLVED]: This was solved with <%# Container.ItemIndex + 1 %> thus taking into account the item you added manually (1 in my case)

- Some attributes maybe are somehow "obscure" for newbies (I tryed to use them based on common sense) like PreserveCurrentItemTemplates or AppendDataBoundItems. Some examples in the docs would be much appreciated, as well as some example accessing the bound field values in the DataBound event to modify them (add paths, change descriptions/titles).

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 06 Dec 2013, 01:11 PM

We tried to replicate the issues you are facing , but to no avail. Attached, you can find the project we used for testing. Please review it and let us know what we are missing. You can try to modify the sample project in order to reproduce the issues on it or isolate the problems in a new project. Thus, we will investigate the problematic behavior locally and come back to you with our findings.

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 the blog feed now.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question