我做错了什么,我无法揣摩出...asp.net的MVC Ajax.ActionLink问题
我有这个在我看来 - CreateForm.aspx
<%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<%= this.Ajax.ActionLink("Create New", "CreateForm", new { nr=ViewData["Nr"]??0 }, new AjaxOptions { UpdateTargetId = "panel" + (String.IsNullOrEmpty((string)ViewData["Nr"]) ? "0" : "1") }, new { id = "panel" + (String.IsNullOrEmpty((string)ViewData["Nr"]) ? "0" : "1") + "Form" })%>
<div id="panel<%=String.IsNullOrEmpty((string)ViewData["Nr"])?"0":"1"%>"></div>
我有这个在我的控制器 -
public ActionResult CreateForm(int nr)
{
ViewData["Nr"] = (nr++).ToString();
return PartialView();
}
当我点击我想到的是响应我的面板#加载(panel0,PANEL1 ...),但我重定向到一个空白页,只有返回的内容链接
这是生成的html
<a href="/Member.aspx/CreateForm?nr=0" id="panel0Form" onclick="Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, updateTargetId: 'panel0' });">Create New</a>
<div id="panel0"></div>
,并点击页面查看源代码看起来像这样
<a href="/Member.aspx/CreateForm?nr=0" id="panel1Form" onclick="Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, updateTargetId: 'panel1' });">Create New</a>
<div id="panel1"></div>
我已经包含了以后的Ajax JS
<script src="/content/Microsoft/MicrosoftMvcAjax.debug.js" type="text/javascript"></script>
,但我预计这将进入panel0 ...我做错了什么?
P.S.
与vs.net调试运行在MicrosoftMvcAjax.debug.js我得到一个错误
周围线3063 ...
var e = Function._validateParams(arguments, [
{name: "id", type: String},
{name: "element", mayBeNull: true, domElement: true, optional: true}
]);
if (e) throw e; <-here it trows an error
是的,我把它们包括在我的Site.Master – bogdanbrudiu 2009-10-01 20:50:55