Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Filling dropdown with all available tabs/pages (choose page dropdown)Filling dropdown with all available tabs/pages (choose page dropdown)
Previous
 
Next
New Post
4/27/2009 1:07 PM
 

In various modules I saw a dropdown where all available pages where listed neatly in a category style with dots indicating that a page is a subpage of another page like:

Home

Page 1

.....Page 1.2

.....Page 1.3

Page 2

Page 3

 

Can someone help how to generate such listing to fill a dropdown so I can build my own "choose a page" dialogue?

 
New Post
4/27/2009 1:27 PM
 

The beauty of open source is that we can find out exactly how this is being done.

The first place that comes to mind to look is the Parent Page drop down when adding a new page.  So, opening up the source of DNN, I can find managetabs.ascx in the admin/Tabs folder of the website.  One I find the control that holds the list of pages (cboTabs), I can find where its DataSource is assigned, and then work backwards from there.

Following the source, you find that it is using the Globals.GetPortalTabs function to get that indented list of tabs.  The calling code looks like this:

GetPortalTabs(PortalSettings.DesktopTabs, currentTabId, True, True, False, True, True)

Hope that helps,


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
4/28/2009 12:34 AM
 

Thanks for your answer. I tried to use it that way, but it always shows an empty dropdown box:

protected void Page_Load(object sender, EventArgs e)
    {
        ddnChooseDefaultTab.DataSource = DotNetNuke.Common.Globals.GetPortalTabs(PortalId, true, true, true, true, true, true);
        ddnChooseDefaultTab.DataSource = DotNetNuke.Common.Globals.GetPortalTabs(PortalSettings.DesktopTabs, TabId, true, false, false, true, true);
        ddnChooseDefaultTab.DataBind();
      
    }

Both the first line and the second line do not work, both produce an empty dropdown box.

 
New Post
4/28/2009 12:45 AM
 

This also did not work, result is an empty dropdown box again:

DotNetNuke.Entities.Tabs.TabController tabController = new DotNetNuke.Entities.Tabs.TabController();
        ArrayList portalTabs = DotNetNuke.Common.Globals.GetPortalTabs(PortalSettings.DesktopTabs, false, true, false, true);
        ArrayList ddnSourceList = new ArrayList();
        string tabName = "";
        string tabId = "";
        foreach (DotNetNuke.Entities.Tabs.TabInfo tabInfoObj in portalTabs)
        {
            tabName = tabInfoObj.TabName;
            tabId = tabInfoObj.TabID.ToString();
            ListItem item = new ListItem(tabName, tabId);
            ddnChooseDefaultTab.Items.Add(item);
        }

 
New Post
4/28/2009 10:55 AM
 

That's quite odd.  I just tried that same code myself, and it worked beautifully...

In the .ascx control, I have the following:

<asp:DropDownList ID="DropDownList" runat="server" DataTextField="TabName" DataValueField="TabId" />

In the Page_Load, I've got the following:

this.DropDownList.DataSource = DotNetNuke.Common.Globals.GetPortalTabs(PortalSettings.DesktopTabs, TabId, true, false, false, true, true);

this.DropDownList.DataBind();

Can you debug and see if the call to GetPortalTabs returns anything?

Hope that helps,


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Filling dropdown with all available tabs/pages (choose page dropdown)Filling dropdown with all available tabs/pages (choose page dropdown)


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out