Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc Ajax动作链接在Telerik MVC网格中的行为异常_Asp.net Mvc_Razor_Telerik - Fatal编程技术网

Asp.net mvc Ajax动作链接在Telerik MVC网格中的行为异常

Asp.net mvc Ajax动作链接在Telerik MVC网格中的行为异常,asp.net-mvc,razor,telerik,Asp.net Mvc,Razor,Telerik,A有一个带有Telerik MVC网格的razor视图。第一列有一个用于删除记录的链接。该链接是一个Ajax Actionlink @( Html.Telerik().Grid<QMS.Models.CustomerTableRow>(Model) .Name("CustomerTable") .Columns(c => { c.Template( @<text>

A有一个带有Telerik MVC网格的razor视图。第一列有一个用于删除记录的链接。该链接是一个Ajax Actionlink

@(
 Html.Telerik().Grid<QMS.Models.CustomerTableRow>(Model)
        .Name("CustomerTable")
        .Columns(c =>
        {
            c.Template(
                @<text>
                @Ajax.ActionLink("Delete","Delete", new { key = item.CustomerKey },new AjaxOptions{ Confirm="Delete this Customer?",UpdateTargetId = "CustomerTable", HttpMethod = "Delete"})
                </text>
                );
            c.Bound(col => col.FirstName);
            c.Bound(col => col.LastName);
            c.Bound(col => col.Email);
            c.Bound(col => col.HomePhone);
        })
        .Pageable()
        .Sortable()
        .Resizable(res => res.Columns(true))
        .Scrollable()
        )

//Action Method in view
 //[HttpDelete]  <-- can't have this or else a "Resource not found" error occurs
        public ActionResult Delete(String key)
        {
                repo.DeleteCustomer(key);
                return PartialView("CustomerTable", repo.GetCustomerTable());
        }
@(
Html.Telerik().Grid(模型)
.名称(“可定制”)
.列(c=>
{
c、 模板(
@
@ActionLink(“删除”,“删除”,新建{key=item.CustomerKey},新建AjaxOptions{Confirm=“删除此客户?”,UpdateTargetId=“CustomerTable”,HttpMethod=“删除”})
);
c、 绑定(col=>col.FirstName);
c、 绑定(col=>col.LastName);
c、 绑定(col=>col.Email);
c、 绑定(col=>col.HomePhone);
})
.Pageable()
.Sortable()
.res可调整大小(res=>res.Columns(true))
.Scrollable()
)
//视图中的操作方法

//[HttpDelete]只是好奇,您是使用jQuery 1.6.1(我相信这是目前最新的版本)还是telerik提供的1.5.1版本

例如,在我的应用程序中,我正在使用 @Html.Telerik().scriptRegistrator().jQuery(false) 要包含Telerik需要的脚本,但不包括jQuery,这样我就可以自己包含它并控制它使用的版本

无论包含哪个版本,您都会得到相同的行为吗


我假设,因为它在网格之外工作,所以您引用了jquery.unobtrusive-ajax.min.js。

只是好奇,您使用的是jquery 1.6.1(我相信这是目前最新的版本)还是telerik提供的1.5.1版本

例如,在我的应用程序中,我正在使用 @Html.Telerik().scriptRegistrator().jQuery(false) 要包含Telerik需要的脚本,但不包括jQuery,这样我就可以自己包含它并控制它使用的版本

无论包含哪个版本,您都会得到相同的行为吗


我假设,因为它在网格之外工作,所以您引用了jquery.unobtrusive-ajax.min.js。

我意识到这已经很晚了,但我最终发现了一个非常类似的问题,并且在搜索结果期间出现了此链接。
我试图向MVC网格的客户机模板添加一个Ajax.Actionlink。最终发现问题源于UpdateTargetID=“myElement”。 Ajax.ActionLink为更新目标生成一个未替换的“#”。
我的工作是:

columns.Bound(p => p.ID).Title("myTitle")
                            .ClientTemplate(Ajax.ActionLink("View", "myAction", "myController", new { myParam = "#=ID#" }, new AjaxOptions() { OnSuccess = "myJSFunction" }).ToHtmlString());

然后:



希望这对某人有所帮助。

我意识到这已经很晚了,但我最终发现了一个非常类似的问题,在搜索结果时出现了此链接。
我试图向MVC网格的客户机模板添加一个Ajax.Actionlink。最终发现问题源于UpdateTargetID=“myElement”。 Ajax.ActionLink为更新目标生成一个未替换的“#”。
我的工作是:

columns.Bound(p => p.ID).Title("myTitle")
                            .ClientTemplate(Ajax.ActionLink("View", "myAction", "myController", new { myParam = "#=ID#" }, new AjaxOptions() { OnSuccess = "myJSFunction" }).ToHtmlString());

然后:



希望这对某人有所帮助。

此项目最近从MVC2转换为MVC3,我忘记添加jquery.unobtrusive脚本:-{此项目最近从MVC2转换为MVC3,我忘记添加jquery.unobtrusive脚本:-{