简体   繁体   English

在 Visual Studio 2010 中使用 Ajax 时出现问题

[英]Problem using Ajax with Visual Studio 2010

I published this problem sometime ago.我前一段时间发布了这个问题。 Someone showed me how to use jquery instead of ajax controls to solve my problem so I accepted that answer.有人向我展示了如何使用 jquery 而不是 ajax 控件来解决我的问题,所以我接受了这个答案。 I now find that I need ajax controls once again.我现在发现我再次需要 ajax 控件。 In particular the AsyncFileUpload control because FileUpLoad is not working for me.特别是 AsyncFileUpload 控件,因为 FileUpLoad 对我不起作用。 So here is the issue again, slightly revised.所以这里又是一个问题,稍作修改。

I am trying to add Ajax controls to my VS 2010 project.我正在尝试将 Ajax 控件添加到我的 VS 2010 项目中。 I have previously gotten it to work when I used VS2008.我以前在使用 VS2008 时已经让它工作了。 I keep getting this exception:我不断收到此异常:

 Error  1   The type 'System.Web.UI.ScriptControl' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.   

Here's what I did.这就是我所做的。 I downloaded the ajax 4 toolkit and added a reference to the project.我下载了 ajax 4 工具包并添加了对项目的引用。 I also added a reference to system.web extension to my project.我还在我的项目中添加了对 system.web 扩展的引用。 When I do this these lines get added to my web.config.当我这样做时,这些行会添加到我的 web.config 中。

<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

I added these lines to my aspx file.我将这些行添加到我的 aspx 文件中。

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %> 

And

<cc1:AsyncFileUpload ID="afuMine" runat="server" />
</asp:Content>

The obvious thing to try is to add a reference to System.Web.Extensions.显而易见的尝试是添加对 System.Web.Extensions 的引用。 Unfortunately that didn't help.不幸的是,这没有帮助。

I also backed off and tried ajax 3.5, this didn't help.我也退出并尝试了 ajax 3.5,这没有帮助。 I did notice that the ajax dll is 4.1 while the 'System.Web.Extensions is 4.0.我确实注意到 ajax dll 是 4.1,而 'System.Web.Extensions 是 4.0。 I don't know if this matters but I cannot find ajax 4.0 or 'System.Web.Extensions 4.1.我不知道这是否重要,但我找不到 ajax 4.0 或 'System.Web.Extensions 4.1。 Thanks once again in advance.再次提前感谢。

You referenced the System.Web.Extensions.Design , the error is you need to reference System.Web.Extensions .您引用了System.Web.Extensions.Design ,错误是您需要引用System.Web.Extensions It's located in the AjaxControlToolkit dll.它位于 AjaxControlToolkit dll 中。 You should use你应该使用

<assemblies>
    ...
    <add assembly="AjaxControlToolkit"/>
</assemblies>

I found the answer in another forum and I wanted to share it with you.我在另一个论坛找到了答案,我想和你分享。 Like the poster, I'm not sure why it worked.就像海报一样,我不确定它为什么会起作用。

http://www.sitefinity.com/devnet/forums/sitefinity-4-x/bugs-issues/reference-to-assembly-system-web-extensions-version-4-0-0-0.aspx http://www.sitefinity.com/devnet/forums/sitefinity-4-x/bugs-issues/reference-to-assembly-system-web-extensions-version-4-0-0-0.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM