English 中文(简体)
在RenderBody()中添加“Ajax”。
原标题:Pressing an asp.net mvc Ajax.ActionLink with Insert into RenderBody() causes an endless loop

我的主要指数是:

<p>@Ajax.ActionLink("Releases", "Index", "Release", new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "ContentPanel" })</p>
<p>@Ajax.ActionLink("Templates", "Index", "Template", new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "ContentPanel" })</p>
<p>@Ajax.ActionLink("Testplans", "Index", "Testplan", new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "ContentPanel" })</p>

如下:

<div id="ContentPanel">
    @RenderBody()
</div>

当我点击每个链路的释放,Templates,在交换看法工作之后,测试计划。

When I click in this order:

Releases
Templates
Releases
Templates

转换不再奏效。 问题似乎是,在我控制器指数方法中设置一个空白点时:

public ActionResult Index()
{
    return View();
}

The Index Action is called in a looooooop ??

为什么如此?

最佳回答

您可以尝试这一法典:

Layout = Request.IsAjaxRequest() ? null : "~/Views/Shared/_Layout.cshtml";
问题回答

暂无回答




相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签