I have the following controller:
我有以下控制器:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace MvcApplication1.Controllers
{
public class TestController : Controller
{
public ActionResult Test()
{
return View();
}
public string AjaxTest()
{
return "Some random text";
}
}
}
I have the following View:
我有以下观点:
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<html>
<head runat="server">
<title>Test</title>
<script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
</head>
<body>
<%= Ajax.ActionLink("Ajax Test", "AjaxTest", new AjaxOptions{UpdateTargetId="testtarget" }) %>
<div id="testtarget">Test Div</div>
</body>
</html>
When I click the action link in IE the controller code runs but the div is NOT updated. Do it in ANY other browser and it works just fine. Is this (yet another) known problem/bug with IE?? Or am I doing something wrong?
当我点击IE中的操作链接时,控制器代码运行但div没有更新。在任何其他浏览器中都可以,而且效果很好。这是(又一个)已知的问题/错误吗?还是我做错了什么?
3 个解决方案
#1
1
if u are using MVC3, check this out, I had the same problem and working now after I followed the suggestion below, but I found that the Ajax ActionLink is caching the requests, but that is a different issue
如果您正在使用MVC3,请检查一下,我也遇到了同样的问题,现在我按照下面的建议进行了操作,但是我发现Ajax ActionLink正在缓存请求,但这是另一个问题
Ajax.ActionLink not working, Response.IsAjaxRequest() is always false
Ajax。ActionLink不可用,Response.IsAjaxRequest()总是错误的
#2
1
I know this question was posted 'bout two years ago, but I figured I might be able to help somebody with this.
我知道这个问题是两年前贴出来的,但我想我可以帮助别人解决这个问题。
IE caches your "favorite" pages (obviously for performance reasons), but it doesn't delete them by default when you clear your browser history.
IE会缓存你的“最爱”页面(显然是出于性能原因),但当你清除浏览器历史时,它不会在默认情况下删除这些页面。
You need to go to internet options, click Delete (under history), and UNCHECK Preserve favorite website data.
您需要访问internet选项,单击Delete(在history下面),并取消检查保存最喜欢的网站数据。
I had the same problem with a regular ASP.Net website, where when I pressed 'Back' or refreshed the page, IE would fetch an older version of my website..
我也有同样的问题。Net网站,当我按下“后退”或刷新页面时,IE会取回我网站的旧版本。
Anyways, hope this helps!
无论如何,希望这可以帮助!
#3
0
You should add doctype:
你应该添加doctype:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Without it, you can have some problems, but still it works for me with it and without. Maybe there is some kind of caching problem? Ctrl + F5 and try again.
没有它,你会有一些问题,但它仍然对我有用,没有。也许存在某种缓存问题?按Ctrl + F5再试一次。
#1
1
if u are using MVC3, check this out, I had the same problem and working now after I followed the suggestion below, but I found that the Ajax ActionLink is caching the requests, but that is a different issue
如果您正在使用MVC3,请检查一下,我也遇到了同样的问题,现在我按照下面的建议进行了操作,但是我发现Ajax ActionLink正在缓存请求,但这是另一个问题
Ajax.ActionLink not working, Response.IsAjaxRequest() is always false
Ajax。ActionLink不可用,Response.IsAjaxRequest()总是错误的
#2
1
I know this question was posted 'bout two years ago, but I figured I might be able to help somebody with this.
我知道这个问题是两年前贴出来的,但我想我可以帮助别人解决这个问题。
IE caches your "favorite" pages (obviously for performance reasons), but it doesn't delete them by default when you clear your browser history.
IE会缓存你的“最爱”页面(显然是出于性能原因),但当你清除浏览器历史时,它不会在默认情况下删除这些页面。
You need to go to internet options, click Delete (under history), and UNCHECK Preserve favorite website data.
您需要访问internet选项,单击Delete(在history下面),并取消检查保存最喜欢的网站数据。
I had the same problem with a regular ASP.Net website, where when I pressed 'Back' or refreshed the page, IE would fetch an older version of my website..
我也有同样的问题。Net网站,当我按下“后退”或刷新页面时,IE会取回我网站的旧版本。
Anyways, hope this helps!
无论如何,希望这可以帮助!
#3
0
You should add doctype:
你应该添加doctype:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Without it, you can have some problems, but still it works for me with it and without. Maybe there is some kind of caching problem? Ctrl + F5 and try again.
没有它,你会有一些问题,但它仍然对我有用,没有。也许存在某种缓存问题?按Ctrl + F5再试一次。