RadTab, multi page view and dynamic RadPanelBar

2 posts, 0 answers
  1. Daniel
    Daniel avatar
    34 posts
    Member since:
    Feb 2011

    Posted 12 Nov 2013 Link to this post


    I am having an issue rooted in the RadTabBar with multi page view.

    I am added a number of controls to a RadPanelBar.  I am adding HtmlGenericControls with hyperlinks to documents and an album control (other 3rd party) that binds to a list of files (jpeg, etc).  When I add this control the RadPanelBar, and add the RadPanelBar to the page (via a PlaceHolder), all works as expected.  I have my docs and my image album.

    However, if I move the PlaceHolder into a RadTab, the RadPanelPar renders, the documents are present, the html shows the album (and supporting jscript), but does not seem to bind the actual images... they are not present.

    Move the Placeholder out of the RadTab... all works again.

    Here is the code oh how I am building all this up 

    private void BuildAttachments()
                List<String> photoPaths = new List<String>();
                List<String> docPaths = new List<String>();
                List<ServiceNote> notes = new List<ServiceNote>();
                Telerik.Web.UI.RadPanelBar panelBar = new RadPanelBar();
                panelBar.ID = ticketId.ToString();
                panelBar.ExpandMode = PanelBarExpandMode.SingleExpandedItem;
                panelBar.Width = 960;
                int y = 0;
                foreach (ServiceTicketTask task in ThisTicket.ServiceTicketTasks)
                    RadPanelItem panelItem = new RadPanelItem();
                    panelItem.Text = task.ServiceItem.Name;
                    panelItem.Enabled = false;
                    foreach (ServiceNote note in task.ServiceNotes.Where(n => n.HasPictures).OrderBy(n => n.CreateDate))
                        RadPanelItem panelNoteItem = new RadPanelItem();
                        panelNoteItem.Text = DateTimeFunctions.UtcToMyTime(note.CreateDate, _loggedInUser.TimeZoneId).ToString();
                        RadPanelItem panelImageItem = new RadPanelItem();
                        panelImageItem.Text = Labeling.Photos;
                        panelImageItem.Expanded = true;
                        RadPanelItem panelDocsItem = new RadPanelItem();
                        panelDocsItem.Text = Labeling.Documents;
                        panelDocsItem.Expanded = true;
                        String photoPath = Storage.GetGalleryPath(ServiceTicket.MakeServiceTicketName(note.ServiceTicketTask.ServiceTicket.ServiceProvider.Abbrev, note.ServiceTicketTask.ServiceTicket.TicketName),
                        if (photoPath != null)
                            panelItem.Enabled = true;
                            String galleryID = String.Format("galleryServiceTickets_{0}", y);
                            GalleryBrowser galleryServiceTickets = new GalleryBrowser();
                            galleryServiceTickets.ID = galleryID;
                            galleryServiceTickets.Visible = true;
                            galleryServiceTickets.Width = 940;
                            galleryServiceTickets.Height = 50;
                            galleryServiceTickets.AllowEdit = false;
                            galleryServiceTickets.AllowPostComment = false;
                            galleryServiceTickets.AllowShowComment = false;
                            galleryServiceTickets.Layout = "Gridshow";
                            galleryServiceTickets.LogonUserName = _loggedInUser.FullName;
                            galleryServiceTickets.GalleryFolder = photoPath;
                            galleryServiceTickets.ToolTip = String.Format("{0} - {1}", note.ServiceTicketTask.ServiceItem.Name, note.CreateDate);
                            TemplateItem template = new TemplateItem(galleryServiceTickets);
                        String docPath = Storage.GetGalleryPath(ServiceTicket.MakeServiceTicketName(note.ServiceTicketTask.ServiceTicket.ServiceProvider.Abbrev, note.ServiceTicketTask.ServiceTicket.TicketName),
                        if (docPaths != null)
                            panelItem.Enabled = true;
                            List<String> filePaths = new List<String>();
                            filePaths = Storage.GetFileCount(docPath);
                            HtmlGenericControl divInner = new HtmlGenericControl("div");
                            divInner.ID = String.Format("DocDiv_{0}", y);
                            divInner.Attributes.Add("style""margin:0;padding:2px 0 0 6px;width:1000px;float:left;text-align:left");
                            Int32 i = 0;
                            foreach (String file in filePaths)
                                String newFile = file.Replace(HttpContext.Current.Server.MapPath(docPath), "").Replace("\\""");
                                String newFilePath = docPath + "/" + newFile;
                                HyperLink hlnkImage = new HyperLink();
                                hlnkImage.ID = String.Format("hlnkImage_{0}_{1}", y, i);
                                hlnkImage.ImageUrl = Utils.GetIcon(newFile);
                                hlnkImage.SkinID = "hlnkImage";
                                hlnkImage.NavigateUrl = newFilePath;
                                hlnkImage.Target = "_blank";
                                hlnkImage.ToolTip = newFile;
                                TemplateItem template = new TemplateItem(divInner);
                                i = i + 1;
                HtmlGenericControl scrollDiv = new HtmlGenericControl("div");
                if (notes.Count() > 15)
                    scrollDiv.Attributes.Add("style""float:left;overflow:scroll;overflow-y:hidden; width:940px;");
                    scrollDiv.Attributes.Add("style""float:left; width:940px;");
     public class TemplateItem : ITemplate
            Control control;
            #region ITemplate Members
            public void InstantiateIn(Control container)
            public TemplateItem(Control ctrl)
                control = ctrl;

    I have moving the call to this method from the page_init to page_load, as well as calling it from within the load event of the tab itself.  In ll cases the results are the same.

    I also moved all this code to a usercontrol and then added the usercontrol to the RadTab... same result

    Thanks for any help...
  2. Nencho
    Nencho avatar
    1446 posts

    Posted 15 Nov 2013 Link to this post

    Hello Daniel,

    The approach you are currently using is the correct one and the controls are rendered in the PageView, where they are nested in - as you had also observed. Therefore, I would suggest you to make sure that you are using the correct approach for binding the mentioned 3rd part product. I would suggest you to verify if the photoPath is the correct one, once the controls are placed in the PageView.

    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.
  3. DevCraft R3 2016 release webinar banner
Back to Top