This is a migrated thread and some comments may be shown as answers.

PanelBar in MOSS Webpart

1 Answer 21 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Chad
Top achievements
Rank 1
Chad asked on 25 Sep 2008, 10:09 PM

When I open the page containing the webpart, it renders but with all of the RadPanelItem's open. Clicking on the PanelItems does nothing, they won't expand or collapse.

It basically opens like this:

=========
-
-
=========
-
-
=========
-
-
=========
-
-

... and the functionality is gone. Clicking the panel headers simply bolds the text, it doesn't expand/collapse.

Here is the code that creates it (sorry for the extra sharepoint stuff, but I thought it might be relevant)

 private void InitializeAccordion()  
        {  
            SPSite oSite = null;  
            SPWeb oSites = null;  
            SPList oList = null;  
              
            radAccordion = new RadPanelBar();  
            radAccordion.ID = "RadPanelBar1";  
            radAccordion.Attributes.Add("runat""server");  
            radAccordion.Skin = RadSkin;  
            radAccordion.Width = new Unit(500, UnitType.Pixel);  
            radAccordion.ExpandMode = PanelBarExpandMode.MultipleExpandedItems;  
            radAccordion.CollapseAnimation.Type = AnimationType.Linear;  
            radAccordion.CollapseAnimation.Duration = 200;  
            radAccordion.CollapseDelay = 0;  
            radAccordion.ExpandAnimation.Type = AnimationType.Linear;  
            radAccordion.ExpandAnimation.Duration = 200;  
            radAccordion.ExpandDelay = 0;  
            radAccordion.EnableViewState = false;  
 
            DataTable groupTable = new DataTable();  
            groupTable.Columns.Add("GroupName");  
            groupTable.PrimaryKey = new DataColumn[]{groupTable.Columns["GroupName"]};  
 
            DataTable listItems = new DataTable();  
            listItems.Columns.Add(TitleField + "1");  
            listItems.Columns.Add(DescriptionField + "2");  
            listItems.Columns.Add(GroupByField + "3");  
 
            try 
            {  
                string titleString, descriptionString, groupString;  
                oSite = new SPSite(this.Page.Request.Url.ToString());  
                oSites = oSite.OpenWeb();  
                oList = oSites.Lists[SelectedList];  
 
                foreach (SPListItem item in oList.Items)  
                {  
                    titleString = CheckFieldValue(item, TitleField);  
                    descriptionString = CheckFieldValue(item, DescriptionField);  
                    groupString = CheckFieldValue(item, GroupByField);  
 
                    listItems.Rows.Add(titleString, descriptionString, groupString);  
 
                    if(groupTable.Rows.Count == 0 || (groupTable.Rows.Count > 0 && !groupTable.Rows.Contains(groupString)))  
                    {  
                        groupTable.Rows.Add(groupString);  
                    }  
                }  
 
                foreach (DataRow row in groupTable.Rows)  
                {  
                    aPanelItem = new RadPanelItem(TrimField(row["GroupName"].ToString(), 90));  
                    aPanelItem.Attributes.Add("runat""server");  
                    aPanelItem.Controls.Add(CreateTable(listItems, row["GroupName"].ToString()));  
                    aPanelItem.Expanded = false;  
                    radAccordion.Items.Add(aPanelItem);  
                }  
            }  
            catch (Exception ex)  
            {  
            }  
            finally 
            {  
                if (oSites != null) oSites.Dispose();  
                if (oSite != null) oSite.Dispose();  
                if (oList != null) oList = null;  
            }  
        } 

and it's added to the page with this...

InitializeAccordion();  
 
            aTimer = new Timer();  
            aTimer.ID = "Timer1";  
            aTimer.Interval = 90000;  
 
            radPanel = new RadAjaxPanel();  
            radPanel.ID = "RadPanel1";  
            radPanel.LoadingPanelID = "RadLoadingPanel1";  
            radPanel.Controls.Add(radAccordion);  
            radPanel.Controls.Add(aTimer);  
 
            radLoadingPanel = new RadAjaxLoadingPanel();  
            radLoadingPanel.ID = "RadLoadingPanel1";  
            radLoadingPanel.Transparency = 30;  
            radLoadingPanel.BackColor = System.Drawing.Color.AliceBlue;  
 
            Controls.Add(radPanel);  
            Controls.Add(radLoadingPanel); 

1 Answer, 1 is accepted

Sort by
0
Chad
Top achievements
Rank 1
answered on 25 Sep 2008, 10:52 PM
Nevermind I found it...

I changed the code that initializes the RadPanelItem's to:

foreach (DataRow row in groupTable.Rows)  
{  
   RadPanelItem anItem = new RadPanelItem();  
   anItem.Controls.Add(CreateTable(listItems, row["GroupName"].ToString()));  
 
   aPanelItem = new RadPanelItem(TrimField(row["GroupName"].ToString(), 40));  
   aPanelItem.Items.Add(anItem);  
 
   radAccordion.Items.Add(aPanelItem);  
Tags
PanelBar
Asked by
Chad
Top achievements
Rank 1
Answers by
Chad
Top achievements
Rank 1
Share this question
or