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

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...State List for moduleState List for module
Previous
 
Next
New Post
2/15/2012 3:51 PM
 

I'm making a module and I'm trying to populate a combobox from code from here:

http://www.dotnetnuke.com/Resources/F...

Unfortunately it appears to be obsolete. I can't figure out how to get updated code that works.

Right now I'm using this:

Dim lc As New ListController()
Dim entryCollection As ListEntryInfo = lc.GetListEntryInfo("Region", "221")
cmbForwardState.DataTextField = "Text"
cmbForwardState.DataValueField = "Value"
cmbForwardState.DataSource = entryCollection
cmbForwardState.DataBind()

When I run the page, it doesn't do anything. :(

 
New Post
2/15/2012 9:13 PM
 

Note that the GetListEntryInfo method returns only a single ListEntryInfo object, not a collection or list that can be bound to a drop-down list control.

Depending upon whether you are using DNN 5.x or 6.x you will want to use one of the following methods of the ListController to return a collection of ListEntryInfo items:

DNN 5.x - GetListEntryCollection which returns a custom ListEntryInfoCollection.

DNN 6.x - GetListEntryInfoItems which returns a generic IEnumerable<ListEntryInfo> collection.

You will then be able to bind the returned collection to the list control as you are now doing.


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
2/22/2012 1:09 PM
 
I still can't seem to get it to work. This code crashes with:

DotNetNuke.Services.Exceptions.ModuleLoadException: Unable to cast object of type 'System.Collections.Generic.List`1[DotNetNuke.Common.Lists.ListEntryInfo]' to type 'DotNetNuke.Common.Lists.ListEntryInfo'. ---> System.InvalidCastException: Unable to cast object of type 'System.Collections.Generic.List`1[DotNetNuke.Common.Lists.ListEntryInfo]' to type 'DotNetNuke.Common.Lists.ListEntryInfo'.


Dim lc As New ListController()
Dim entry As DotNetNuke.Common.Lists.ListEntryInfo = lc.GetListEntryInfoItems("Region", "221")
 
New Post
2/22/2012 1:50 PM
 
Ahh got it! Here's the complete code to populate DNN 6 states list to a user control/module.

Dim lc As New DotNetNuke.Common.Lists.ListController()
Dim entryCollection As System.Collections.Generic.List(Of DotNetNuke.Common.Lists.ListEntryInfo)
entryCollection = lc.GetListEntryInfoItems("Region", "Country.US", 0)

With cmbForwardState
.DataTextField = "Text"
.DataValueField = "Value"
.DataSource = entryCollection
.DataBind()
End With
 
New Post
8/31/2012 9:55 PM
 

Hey guys,

Running DNN 6 after upgrading from DNN 3 through multiple steps.  I am referencing the new DNN 6 dotnetnuke.dll in code.  My current code is:

Dim countryCode As String = "US"
                        Dim ctlEntry As New ListController
                        Dim listKey As String = "Country." & countryCode
                        Dim entryCollection As ListEntryInfoCollection = ctlEntry.GetListEntryInfoCollection("Region", "", listKey)

It complies fine but it says it can't find the method GetListEntryInfoCollection.  When I look for the method GetListEntryInfoItems 
I can't find it in the DLL.  Any ideas?  Is there a way to update the methods in the dll?  Maybe for some reason Visual Studio 2010 is still seeing the old references?

Thanks,

J

 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...State List for moduleState List for module


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