How to know which type a section is

Topics: Developer Forum
May 20, 2008 at 4:26 PM
Is there a way - loading a web page - to know of which type a section is?
May 20, 2008 at 7:14 PM
Depending on how you will use the information you can examine the code in default.aspx.cs
This function list all Sections in the application.
There's also The WebPage.Sections in WebSite class 

                Hashtable list = new Hashtable();
                foreach (Type t in _page.GetType().Assembly.GetTypes())
                {
                    if (t.IsClass && (t.GetInterface("ISection") != null) && (!t.IsAbstract))
                        list.Add(t.Name, t.AssemblyQualifiedName);
                }

                SortedList sortedlist = new SortedList(list);
                for(int i = 0; i< sortedlist.Count; i++){
                    string ResourceID = "ctl_" + sortedlist.GetKey(i).ToString() + "_RssTitle";                     
                    string ListName = Resources.StringsRes.ResourceManager.GetString(ResourceID); //Get's the resource title 
                    cmbSections.Items.Add(new ListItem(ListName, sortedlist.GetByIndex(i).ToString())); // Adds the section to dropdownlist
                }

May 21, 2008 at 7:19 AM
Thanks Rickard