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...Building ExtensionsBuilding ExtensionsModulesModulesUsing DNN built-in List functionalityUsing DNN built-in List functionality
Previous
 
Next
New Post
1/8/2010 12:49 PM
 

 We are trying to use the built-in DotNetNuke List functionality to populate a State Drop-Down list in an information request module. We get the list populated and the functionality appears to be fine until the postback that saves the data to the table.

At that point, the dropdown list control is empty. The selectedindex property of the ddlState control is -1 and the SelectedValue is blank.

The problem appears to be a state issue where the values of the dropdown control are not passed back (or possibly not actually set by the control).

Anyone have any similar problems or suggestions...Don't want to have to provide a state table when the list already exists in DNN...(but the DropDownList bound to the States Table via a SQL Query works!!)

 
New Post
1/13/2010 2:43 PM
 

How are you binding to the drop down list?  Did you accidentally disable ViewState by chance?


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
1/13/2010 7:52 PM
 

Here is the code used to load and bind to the ddl control:

Within the html Table on the ascx form, here is the row that contains the drop down control:

 

<tr valign="top">

 

<td class="SubHead" width="200px" >

 

<dnn:label id="lblState" controlname="ddlState" runat="server" suffix=":" />

 

</td>

 

<td class="style6">

 

<asp:DropDownList ID="ddlState" runat="server" Width="116px" Height="22px" />

 

</td>

 

<td>

 

 

<asp:RequiredFieldValidator ID="rfvState" runat="server" resourcekey="valState" ControlToValidate="ddlState" ValidationGroup="Submit" InitialValue="SS" />

 

</td>

 

</tr>

Module Level assignment:

 

Private stateList As ListEntryInfoCollection = Nothing

In the Page_Load method, inside of a If Not Page.IsPostBack statement I have the following code:

 

stateList = ListCtlr.GetListEntryInfoCollection(

 

 

Dim ListCtlr As New ListController()"Region", "Country.US")Me.ddlState.DataSource = stateListMe.ddlState.DataTextField = "Text"

 

Me.ddlState.DataValueField = "Value"

 

Try

 

 

 

 

Me.ddlState.DataBind()Me.ddlState.Items.Insert(0, New ListItem("Select State", "SS"))Catch ex As ExceptionEnd Try

The ddlState control has EnableViewState to TRUE in the ascx code...

The States appears, including the Select State, which is the first item in the list. I can select the state in the dropdownlist, and all appears to be fine.

However, when I try to pull the data from the form field TextBox and DDL controls, the ddlState is completely empty. No DataSource, no DataValueField, no DataTextField, nothing...The SelectedListIndex is -1 (Not zero, which is is when the page displays). I'm completely baffled...

 

 
New Post
1/13/2010 9:04 PM
 

Although your code became a bit scrambled when posting to the forum, it looks fine. Are you absolutely sure that you are databinding ddlState ONLY within a Not Page.IsPostBack conditional and that your submit button is performing a postback rather than a redirect back to the same URL?


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
1/14/2010 12:52 AM
 

David - empty drop down lists on postback are generally one of these things;
1.  no viewstate either on control, container or page level

2. databind event somewhere in the pageload functionality (databinding actions should run under a 'if not isPostback' condition)

3. Logic somewhere in your postback code that is clearing the list incorrectly

I doubt it has anything in particular to do with using the DNN list functionality, because it doesn't look at the postback status of a page. 

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesUsing DNN built-in List functionalityUsing DNN built-in List functionality


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