代码移动到其他服务器后,DropDownList对SelectedIndexChanged没有响应

时间:2010-01-27 22:49:42

标签: c# events

代码在我的开发机器(localhost)上工作正常,但在我将它移动到开发服务器后,我的下拉列表中没有触发SelectedIndexChanged例程。

是什么给出的?我迷路了......任何意见都表示赞赏。

使用asp.net 3.5 c#

protected void Page_Load(object sender, EventArgs e)
        {
            ddlDepartments.SelectedIndexChanged += new EventHandler(ddlDepartments_SelectedIndexChanged);
            ddlSections.SelectedIndexChanged += new EventHandler(ddlSections_SelectedIndexChanged);


            btnAddMethod.Enabled = false;
            txtRepSplitsNum.Visible = false;
            lblRepSplitsNum.Visible = false;


            //at first load, populate the departments list
            if (!IsPostBack)
            {
                m_dtDeptsList = m_dataController.GetDepartments();

                HttpHelper.StoreInSession(Keys.deptsList, m_dtDeptsList);
                UIUtils.BindDropDownList(ref ddlDepartments, m_dtDeptsList, DeptsDDLColumns.deptCode, DeptsDDLColumns.deptName, true);
            }

        }

protected void ddlDepartments_SelectedIndexChanged(object sender, EventArgs e)
        {

            ddlMethods.ClearSelection();
            ddlMethods.Enabled = false;



            Response.Write(ddlDepartments.SelectedValue);


            DataTable dt = m_dataController.GetDepartmentSections(ddlDepartments.SelectedValue);

            UIUtils.BindDropDownList(ref ddlSections, m_dataController.GetDepartmentSections(ddlDepartments.SelectedValue), SectsDDLColumns.sectCode, SectsDDLColumns.sectName, true);
        }

在我的aspx中

<asp:DropDownList ID="ddlDepartments" runat="server"  AppendDataBoundItems="true" OnSelectedIndexChanged="ddlDepartments_SelectedIndexChanged" AutoPostBack="true" onchange="needToConfirm = false;">
                 </asp:DropDownList>

1 个答案:

答案 0 :(得分:0)

发现问题

viewstate在开发服务器上已关闭