Results 1 to 2 of 2

Thread: Repeater, paging and image gallery

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2009
    Posts
    313

    Repeater, paging and image gallery

    This is my situation:

    I use prettyPhoto to display images from database. The images are displayed in a Repeater control with paging enabled, and with page size set to 3.

    Everything works fine, the gallery loads up, I can go through pictures. But, prettyPhoto loads only 3 pictures at a time. So if I get 12 pictures from the database, I get 4 pages. So every time I have to view pictures from Page1, close the gallery, click the Next button that displays Page2 and so on.

    I understand that this is happening because I set the PageSize to 3. I'm not sure how to "tell" prettyPhoto that there are actually more photos.

    This is how I bind the Repeater to the datasource:

    vb.net Code:
    1. Dim Pds1 as New PagedDataSource()
    2. Pds1.DataSource = dsPictures.Tables(0).DefaultView
    3. Pds1.AllowPaging = True
    4. Pds1.CurrentPageIndex = CurrentPage
    5.  
    6. Repeater3.DataSource = Pds1
    7. Repeater3.DataBind

    This is the HTML for the page that uses the Repeater and gallery:

    vb.net Code:
    1. <a href = '<%#DataBinder.Eval(Container, "DataItem.newsPictureURL")%>' rel="prettyPhoto[Repeater3]" title = '<%#DataBinder.Eval(Container, "DataItem.newsPictureCaption")%>
    2. <img id="icons" src = '<%#DataBinder.Eval(Container, "DataItem.newsPictureLocation")%>' alt = '<%#DataBinder.Eval(Container, "DataItem.newsPictureDesc")%>' />

    As you can see, I use rel="prettyPhoto[Repeater3]" where Repeater3 is the name of the gallery, or DataSource.

    I know it is hard to figure out anything with out inspecting the prettyPhoto source (jQuery), but if anyone has any idea how to accomplish this, please share.

    Thank you.

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: Repeater, paging and image gallery

    Unfortunately i haven't used that control.
    Anyhow, if possible i would get the pictures currently loaded to prettyphoto and modify the pagesize. The problem here is that you are using a client control and a server control together so i am not sure how you can notify the server control about the pictures number.
    You could p.e. count all the rows that are loaded at instantiation to the repeater and do a division so you can come to the pics per page you need. I think that could be done at pre-render but not 100% sure.
    Another options is to set a web service but it a little vague in my mind how you can set data from the prettyphoto and then get the data from the repeater.
    Another option yet would be to use a client side control instead of the repeated to display data. I think slimgrid, slickgrid or something is used with Jquery.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width