尝试在具有RazorPages的ViewComponent中使用Kendo DropDownList,但得到404

我仍然很喜欢RazorPages,但是使用ASP.Net已有多年了。大多数示例引用了MVC控制器和操作。是的,我知道剃刀页面就像一个“迷你控制器”,命名的处理程序方法等同于动作。但是,我似乎无法让我的ViewComponent执行我从DropDownList引用的方法。

在我的VC内,我有一个DropDownList,它试图使用Ajax绑定到其中一个处理程序方法。

    @(Html.Kendo().DropDownList()
              .Name("Customer")
              .DataTextField("Name")
              .DataValueField("Value")
              .Events(e => e.Change("change"))
              .DataSource(source => source
                 .Ajax()    
                 .ServerOperation(true)
                 .Read(r => r.Url("./BoxTerminal?handler=BoxList"))
              )
              .Value("1")
              .AutoWidth(true)
    )

此组件被注入到其父页面中,当我开始调试会话时,我在VC的InvokeAsync方法中遇到一个断点,但是响应完成后,我在浏览器中查看了开发控制台,尝试执行方法BoxList的404错误

在我的BoxTerminal ViewComponent中。这里的断点永远不会被击中。 在开发控制台中,我看到了404
http://localhost:60101/BoxTerminal?handler=BoxList

ViewComponent本身位于Pages文件夹中
| __Components
 | __BoxTerminal.cs
 | __Default.cshtml

public JsonResult OnPostBoxList([DataSourceRequest] DataSourceRequest request)
{
    List<SimpleStringPair> retval = new List<SimpleStringPair>();
    retval = ... do some stuff,return a list
    return new JsonResult(retval.ToDataSourceResult(request));
}
yangyaolei 回答:尝试在具有RazorPages的ViewComponent中使用Kendo DropDownList,但得到404

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3164402.html

大家都在问