Gallery rebinding

  •  11-19-2013, 5:27 AM

    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:
View Complete Thread