Telerik
Skip Navigation LinksHome / Community / Forums / ASP.NET > Panelbar > Accessing UserControl within Panel Item and Panel Bar

Not answered Accessing UserControl within Panel Item and Panel Bar

Feed from this thread
  • Raj avatar

    Posted on Apr 20, 2009 (permalink)

    Hello,

    I have an issue when accessing user control within Rad Panel Bar and Rad Panel Item but I am succsussful in loading the user control dynamically please see the code below. Please let me know what I am doing wrong.

    Any help greatly appreciated.

    LOADING THE USER CONTROL:

    foreach (GuideSheetGroup guidesheetgroup in oGSGs)  
                {  
                    uxGuideSheet gsCTRL = (uxGuideSheet)LoadControl("~/Controls/uxGuideSheet.ascx", guidesheetgroup.GuideSheetTypeID);  
                    RadPanelItem rootItem = new RadPanelItem();  
                    rootItem.Text = guidesheetgroup.GuideSheetGroupDesc.ToString();  
                    rootItem.Font.Bold = true;  
                    rootItem.PreventCollapse = false;  
                    rootItem.Style.Add(HtmlTextWriterStyle.TextAlign, "left");  
                    rootItem.Style.Add(HtmlTextWriterStyle.Left, "0");  
                    rootItem.Value = guidesheetgroup.GuideSheetTypeID.ToString();  
                      
                    RadPanelItem childItem = new RadPanelItem();  
                    childItem.Value = "templateHolder15";  
                    childItem.Controls.Add(gsCTRL);  
                    childItem.PreventCollapse = false;  
                    childItem.Style.Add(HtmlTextWriterStyle.TextAlign, "left");  
                    childItem.Style.Add(HtmlTextWriterStyle.Left, "0");  
                    rootItem.Items.Add(childItem);  
                    radPanelBarGuideSheets.Items.Add(rootItem);  
                    rootItem = null;  
                    childItem = null;  
                } 

     

     

     

    ACCESSING THE USER CONTROL:

     

     

    RadPanelBar rpbGS = (RadPanelBar)uGuideSheets.FindControl("radPanelBarGuideSheets");  
                if (rpbGS != null)  
                {  
                    foreach (RadPanelItem guideSheet in rpbGS.Items)  
                    {  
                        RadPanelItem rdPanelItem = (RadPanelItem)guideSheet.Items[0];  
     
                        UserControl uxC = (UserControl)rdPanelItem.Items.FindItemByValue("templateHolder15").FindControl("uxGuideSheet");  
                          
                          
                    }  
                } 

     

     

     

     

     

     

     

     

    Reply

  • Telerik Admin admin's avatar

    Posted on Apr 20, 2009 (permalink)

    Hi Raj,

    Please use the FindItemByValue method of the RadPanelbar control. You are now using the FindItemByValue exposed by the items. That method is not looking through all items in the panelbar - just within the current collection.

    All the best,
    Albert
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.

    Reply

Back to Top

Skip Navigation LinksHome / Community / Forums / ASP.NET > Panelbar > Accessing UserControl within Panel Item and Panel Bar

Powered by Sitefinity ASP.NET CMS

Contact Us | Site Feedback | Terms of Use | Privacy Policy
Copyright © 2002-2010 Telerik. All rights reserved.