我有一个MVC4/Web API项目,我创建了一个测试页面,使用Ajax消耗Web API。测试进行得很顺利,所以我开始着手UI界面的工作。我需要做的一件事是用从Web API返回的数据填充一些表单控件。我使用了JQuery来完成这个任务。
现在,当我运行应用程序并提交表单时,会出现一个错误指示页面已被更新:
为解决此问题,我将表单控件包装在UpdatePanel中,并添加ScriptManager控件。现在在构建时出现以下错误:
我已经完全清理了我的解决方案。删除了 obj/Debug 和 obj/Release 文件夹。我研究了这两个问题,它们似乎经常一起出现。我安装了 AjaxControlToolbox,但没有什么变化。
是否需要手动添加某些内容到 web.config 文件中或者我应该寻找其他的解决方案?
现在,当我运行应用程序并提交表单时,会出现一个错误指示页面已被更新:
Invalid postback or callback argument. Event validation is enabled using <pages
enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %>
in a page. For security purposes, this feature verifies that arguments to postback
or callback events originate from the server control that originally rendered them.
If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation
method in order to register the postback or callback data for validation.
为解决此问题,我将表单控件包装在UpdatePanel中,并添加ScriptManager控件。现在在构建时出现以下错误:
The type or namespace name 'ScriptManager' does not exist in the namespace
'System.Web.UI' (are you missing an assembly reference?) C:\Users\xxx\Documents\
Visual Studio 2012\Projects\xxxxxxxxx\xxxxxxxx.Web.API\Public\
xxxxxxxxxxx.aspx.designer.cs 31 41 xxxxxxxx.Web.API
并且
The type or namespace name 'UpdatePanel' does not exist in the namespace
'System.Web.UI' (are you missing an assembly reference?) C:\Users\xxx\Documents\
Visual Studio 2012\Projects\xxxxxxxx\xxxxxxxx.Web.API\Public\
xxxxxxxxxxx.aspx.designer.cs 40 41 xxxxxxxx.Web.API
我已经完全清理了我的解决方案。删除了 obj/Debug 和 obj/Release 文件夹。我研究了这两个问题,它们似乎经常一起出现。我安装了 AjaxControlToolbox,但没有什么变化。
是否需要手动添加某些内容到 web.config 文件中或者我应该寻找其他的解决方案?