Using DotNetNuke lists (c# included)

A quick update for using DotNetNuke's built in List functionality.

If you're logged in as a HOST you can create new lists from the HOSTS/LISTS menu.

If you want to access lists programatically? Here's some simple code for doing so, this uses the included United States region (States) list. In C# of course.

import DotNetNuke.Common.Lists;

using

then use the following in your code

ListController lc = new ListController();

ListEntryInfoCollection leic = lc.GetListEntryInfoCollection("Region","","Country.US");

ddlStates.DataTextField = "Text";

ddlStates.DataValueField = "Value";

ddlStates.DataSource = leic;

ddlStates.DataBind();

ddlStates.Items.Insert(0, new ListItem("Select State", "-1"));

 

Pretty simple! now get to it!

4 Comments

  • Awesome. I always used to wonder about how to use those lists programmatically. Thank you.

  • How to add external data to a list in DotNetNuke lists

    ListController lc = new ListController();

    ListEntryInfoCollection leic = lc.GetListEntryInfoCollection("Region","","Country.US");

    I want to add one more item to

    leic
    how to do?

  • Do you want to add it programatically or into the database?

  • How to add external data to a list in DotNetNuke lists

    ListController lc = new ListController();

    ListEntryInfoCollection leic = lc.GetListEntryInfoCollection("Region","","Country.US");

    I want to add one more item to

    leic

    how to do?

    I want to add it into the database?

Comments have been disabled for this content.