1

I'm trying to port a simple project from an Umbraco 4.7.0 deployment to an Umbraco 6.2.1 deployment. The project works fine in 471, but when running in the 621 deployment none of the form values are picked up by the code behind. I can see the values in Request.form[uniqueId] but the selected value for the dropdown is blank.

The control is created in the OnInit event and I try to get the value in the Page_Load event.

Is there anything obvious that I am doing wrong here? Any obvious reason for this to stop working in 621?

The page:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Search.ascx.cs" Inherits="MyApp.Search" EnableViewState="true" ViewStateMode="Enabled" %>

<form runat="server" enableviewstate="true">
  <asp:PlaceHolder ID="placeHolder" runat="server" EnableViewState="true" />
</form>

The code behind:

protected override void OnInit(EventArgs e)
{
  base.OnInit(e);

  DropDownList ddlCriteria = new DropDownList();
  ddlCriteria.ClientIDMode = System.Web.UI.ClientIDMode.Static;
  ddlCriteria.ID = "organizationId";
  ddlCriteria.EnableViewState = true;
  ddlCriteria.ViewStateMode = System.Web.UI.ViewStateMode.Enabled;
  ddlCriteria.Items.Clear();
  ddlCriteria.Items.Add(new ListItem("1", "1"));
  ddlCriteria.Items.Add(new ListItem("2", "2"));
  ddlCriteria.Items.Add(new ListItem("3", "3"));
  placeHolder.Controls.Add(ddlCriteria);
}


protected void Page_Load(object sender, EventArgs e)
{
  Page.MaintainScrollPositionOnPostBack = false;
  DropDownList ddlCriteria = (DropDownList)placeHolder.FindControl("organizationId");
  String organizationId = ddlCriteria.SelectedValue; // Always blank.
}

Many thanks for any help.

Matt
  • 13,948
  • 6
  • 44
  • 68

0 Answers0