【问题标题】:kendo ui button http post not firing剑道ui按钮http帖子未触发
【发布时间】:2014-02-04 04:25:16
【问题描述】:

在我的 index.cshtml 页面中,以下代码行会触发 HttpPost,以便我可以进入控制器类中的 HttpPost 标记的 Index 方法。

 <input type="submit" value="Run Calculation" />

            [HttpPost]
            public ActionResult Index(TimberBeamCalculator.Models.Dimensions dim)
            {
    ..................
            }

但是下面的 kendo ui 按钮代码,不会触发上面提到的 HttpPost。

 @Html.Kendo().Button().Name("setting").Icon("pencil").HtmlAttributes(new { type = "button" }).Content("Run Calculation");

我错过了什么??

【问题讨论】:

  • 发帖的呼声在哪里?您不必为帖子创建点击处理程序吗?
  • “提交”类型的输入将导致包含提交按钮的表单发布到服务器。

标签: c# asp.net-mvc-4 kendo-ui


【解决方案1】:

Kendo.button 不会呈现为提交按钮。您要么需要调整剑道按钮的属性以使其成为提交按钮,要么使用 jquery 来执行类似

的操作
$("#setting").click(function()
{ 
  $("#idOfYourForm").submit();
});

首先,您应该尝试将您的剑道按钮的 HtmlProperties 设置为提交类型。如果这不起作用,请使用我提到的 jquery 路线。

【讨论】:

  • 嗨,乔,以下为我工作。 @Html.Kendo().Button().Name("setting").Icon("pencil").HtmlAttributes(new { type = "submit" }).Content("Run Calculation");谢谢
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多