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

population from WebMethod problem

1 Answer 48 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
übermensch
Top achievements
Rank 1
übermensch asked on 02 Oct 2009, 08:40 PM

I have a webmethod which returns the rows from the query, and passes it as a list.  I am using two classes to assign the values. 

        public class Types  
        {  
            public Types()  
            {  
                this.Defs = new List< Definitions>();  
            }  
            public string Name  
            {  
                get;  
                set;  
            }  
            public int Sort  
            {  
                get;  
                set;  
            }  
            public Definitions Defs  
            {  
                get;  
                set;  
            }  
        }  
        public class Definitions  
        {  
            public string Name  
            {  
                get;  
                set;  
            }  
        } 

 

I am unsure if I am doing this correctly, but this is what I am trying to accomplish.  Each Type is a RadPanelBarItem Parent of a Definition.  There are multiple Types and Definitions.  This is the closest I have come to implementing this in this way. 

 

ObservableCollection<Types> events = e.Result;  
 
   
 
                //find a specific object  
 
                String _type = events.FirstOrDefault().Type;  
 
   
 
                IEnumerable<Types> qry = from c in events  
 
                                             where (c.Type.ToString().Equals(_type))   
                                             orderby c.Sort  
 
                                             select c;  
 
   
 
                int ct = 0;  
 
                if (qry != null)  
 
                {  
 
                    RadPanelBarItem head = new RadPanelBarItem()  
 
                    {  
 
                        Header = _type  
 
                        ,  
 
                        Style = Application.Current.Resources["radPanel_StyleInd"as Style  
 
                    };  
 
                    foreach (Types typ in qry)  
 
                    {  
 
                        if (inc.IsActive == true)  
 
                        {  
 
                            RadPanelBarItem pbi = new RadPanelBarItem()  
 
                            {  
 
                                Name = inc.IncType.ToLower() + "_Def_" + ct   
 
                                ,  
 
                                Style = Application.Current.Resources["radPanel_StyleInd"as Style  
 
                            };  
 
                            pbi.Selected += new EventHandler<Telerik.Windows.RadRoutedEventArgs>(pbi_Selected);  
 
                            head.Items.Add(pbi);  
 
                            ct++;  
 
                        }  
 
   
 
                    };  
 
                        pb.Items.Add(head);  
 
                    }  
 
            }
 
 

 

Right away you can see that it isn’t dynamically adding the head—parent items.  I need it to add the Types as the head, parent items and definitions as child items… any idea how to accomplish this?

1 Answer, 1 is accepted

Sort by
0
übermensch
Top achievements
Rank 1
answered on 05 Oct 2009, 01:40 PM
*bump*
Sorry, just need an extra pair of eyes on this please.

Thanks
Tags
PanelBar
Asked by
übermensch
Top achievements
Rank 1
Answers by
übermensch
Top achievements
Rank 1
Share this question
or