Turn Datapager pagesize on or off if something within listview is clicked RRS feed

  • Question

  • Hi Guys,

    I've created a gallery of thumbnail images using the datapager control and limited the pagesize to 9 to fit in with the design of my webpage. This works great and you can page through 9 sets of image at a time in an isolated div. However I also want to use one of the jquery gallery plugins, lightbox - which dims out the background and gives the full image on screen.

    This is where I encounter my problem, because I have limited the pagesize to 9, my jquery lightbox is only displaying 9 images from my datapager. Is there a way in C sharp from the code behind (hence the reason I have posed here and not the asp forums) - to tell Jquery lightbox to use all the images (whether it is 9 or 100+) from my list view and ignore the datapager page size attribute. I have added my listview/datapager code and my jquery code to show you what I've got working. I think i'm just looking for a way to in the code behind to change the datapager size limit to 100+/ or disable this, if one the thumbnail images has been clicked on.

    If its a asp question, I do apologise, please let me know and I will copy the post onto their forum.  

    <div id="gallery_box" runat="server">
    <div class="breadcrumb"><span class="right_boldText">Gallery</span></div>
        <asp:DataPager ID="DataPager1" PagedControlID="ListView3" runat="server" PageSize="9">  
                <asp:NextPreviousPagerField ButtonType="Image" PreviousPageImageUrl="../images/previous.png" ButtonCssClass="prev-item"  ShowNextPageButton="false"/>                      
                <asp:NextPreviousPagerField ButtonType="Image" NextPageImageUrl="../images/next.png" ButtonCssClass="next-item" ShowPreviousPageButton="false" />
    <asp:ListView runat="server" ID="ListView3">
            <ul id="gallery_matrix">
                <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
            <div class="gallery_box_image">
                <a href="<%# Eval("Quicklink") %>?maxwidth=680&maxheight=680">
                        <img src="<%# Eval("Quicklink") %>?maxwidth=70&maxheight=70" class="lightbox" id="<%# Eval("Quicklink") %>" />

    Jquery code
    <script type="text/javascript">
            $(function () {
            if ($('#ctl00_ctl00_cp1_Gallery_gallery_box').length != 0) {
                $('#ctl00_ctl00_cp1_Gallery_gallery_box a').lightBox({
                overlayBgColor: '#FFF',
                    overlayOpacity: 0.6

    • Moved by Lisa Zhu Monday, May 21, 2012 6:58 AM thread about asp.net (From:Visual C# Language)
    Saturday, May 19, 2012 6:22 AM


  • Hi ,

     This is a question about asp.net , You may have more luck getting answers in the ASP forums rather than the C# forums.

    Lisa Zhu [MSFT]
    MSDN Community Support | Feedback to us

    • Proposed as answer by Mr. Wharty Thursday, May 31, 2012 12:31 AM
    • Marked as answer by Mr. Wharty Thursday, June 7, 2012 2:54 AM
    Monday, May 21, 2012 6:57 AM