DotNetNuke Developer Chris Hammond

DotNetNuke Core Team Member

News

Thanks for visiting my blog, you can find more about me at ChrisHammond.com or on my company's website at Engage Software.

Cool Sites

My domains

Projects

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!

Comments

AJ said:

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

# July 15, 2007 3:13 AM

Shreekala said:

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?

# January 16, 2008 5:11 AM

Chris Hammond said:

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

# January 19, 2008 11:00 PM

kiran said:

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?

# August 12, 2008 7:30 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)