+ -
当前位置:首页 → 问答吧 → Ajax中运用DropDownList出错问题?

Ajax中运用DropDownList出错问题?

时间:2011-12-09

来源:互联网

我用的是VS2010开发的程序,IE9浏览器(Win7、Windows2008 R2),本来测试得很好的WEB应用程序,安装了一个财务软件用友U810.1版本,就出现了DropDownList下拉列表不能回发响应的问题,查了很多资料,都没能解决呀,郁闷!
HTML code

<form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>   
            <div>
                <asp:DropDownList ID="ddlList" runat="server" Width="150px"  AutoPostBack="true"
                    onselectedindexchanged="ddlList_SelectedIndexChanged">
                    <asp:ListItem Value="0">财务部</asp:ListItem>
                    <asp:ListItem Value="1">办公室</asp:ListItem>
                    <asp:ListItem Value="2">仓库</asp:ListItem>
                    <asp:ListItem Value="3">经理室</asp:ListItem>
                    <asp:ListItem Value="4">营销部</asp:ListItem>
                    <asp:ListItem Value="5">生产部</asp:ListItem>   
                    <asp:ListItem Value="6">管理部</asp:ListItem>  
                    <asp:ListItem Value="7">技术部</asp:ListItem>   
                </asp:DropDownList>
                <br /><br />
                <asp:Label ID="lblON" runat="server" Text=""></asp:Label>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    </form>


C# code

 protected void ddlList_SelectedIndexChanged(object sender, EventArgs e)
        {
            lblON.Text ="你选择的部门是:"+ ddlList.SelectedItem.Text;
        }


反复调试总是出现如下的错误:
Microsoft JScript 运行时错误: Sys.WebForms.PageRequestManagerServerErrorException: 回发或回调参数无效。在配置中使用 <pages enableEventValidation="true"/> 或在页面中使用 <%@ Page EnableEventValidation="true" %> 启用了事件验证。出于安全目的,此功能验证回发或回调事件的参数是否来源于最初呈现这些事件的服务器控件。如果数据有效并且是预期的,则使用 ClientScriptManager.RegisterForEventValidation 方法来注册回发或回调数据以进行验证。
可是卸载了用友U810.1版本,又可以正常使用了,不知道是问题出在哪里?

作者: vs2005   发布时间: 2011-12-09

不要告诉我,采用EnableEventValidation="false"此类的方式,我是需要页面验证的,没人遇到过吗?

作者: vs2005   发布时间: 2011-12-10