Gallery rebinding

Last post 12-03-2013, 11:41 AM by davenel. 2 replies.
Sort Posts: Previous Next
  •  11-19-2013, 5:27 AM 78382

    Gallery rebinding

    I have placed the gallery control in a gridview.  The Gallery binds properly and displays the images on the initial page load.

    If their is a post back to the page, even if the databind event of the gridview is called, (which in turn rebuilds the galleries and rebinds them), the galleries do not bind.  I can see in the html the gallery is there, the java is there, but no images.

     

    Please help me understand the issue.  Below is a method of code , how I build and bind the galleries.  It is called within the databind of the gridview

     

     private static GalleryBrowser BuildGallery(ServiceNote note)
     {             
          String photoPath = null;             
          GalleryBrowser galleryServiceTickets = null;             
          photoPath = Storage.GetGalleryPath(note, Storage.DocumentGroups.Photos);
          if (photoPath != null)             
          {
                Int32 pixCnt = (Directory.GetFiles(HttpContext.Current.Server.MapPath(photoPath), "*.*"SearchOption.TopDirectoryOnly).Length / 3);
                String galleryID = "galleryServiceTickets_" + note.ID.ToString();
                galleryServiceTickets = new GalleryBrowser();                 
                galleryServiceTickets.ID = galleryID;                 
                galleryServiceTickets.Visible = true;                 
                galleryServiceTickets.Width = 160;                 
                if (pixCnt < 3)                     
                      galleryServiceTickets.Height = 50;                 
                else if (pixCnt > 3 && pixCnt < 5)                     
                      galleryServiceTickets.Height = 75;                 
                else                     
                      galleryServiceTickets.Height = 100;                 
                galleryServiceTickets.AllowEdit = false;                 
                galleryServiceTickets.AllowPostComment = false;                 
                galleryServiceTickets.AllowShowComment = false;                 
                galleryServiceTickets.Layout = "Gridshow";                             
                galleryServiceTickets.GalleryFolder = photoPath;                 
                galleryServiceTickets.DataBind();             
          }            
          return galleryServiceTickets;         
    }
     
    Thanks in advance 

    Filed under:
  •  11-21-2013, 3:07 PM 78408 in reply to 78382

    Re: Gallery rebinding

    Hi davenel,

     

    Can you create an example page which can reproduce this issue and send it to [email protected]? So I can check it directly.

     

    Regards,

     

    Ken 

  •  12-03-2013, 11:41 AM 78495 in reply to 78408

    Re: Gallery rebinding

    I kenneth.... 

     

    Sorry for the late reply... I thought I had checked the box to receive an email on reply... but I think I missed it... I just checked out of curiosity and saw your note.

     

    I will see if I can put together a small project to show the issue... but in a nutshell, the gallery does not rebind the images on any post back after the initial load.  So if I add a new record to the datagrid, I can't simply rebind the grid, I have to do a redirect back to the same page to get the gallery to bind and load the images.

     

View as RSS news feed in XML