简体   繁体   English

如何处理 asp.net MVC c # 中的发送参数按钮?

[英]How to handle a send parameter button in asp.net MVC c #?

How to handle a send parameter button in asp.net MVC c #?如何处理 asp.net MVC c # 中的发送参数按钮?

<form id="form" name="form" action="" method="post">
    <label>Nom : </label>
    <input type="text" id="NAME" name="NAME" class="form-control"  value=@Model.NAME required />
    <input type="submit" value="importer  />
</form>

Use Ajax begin Form to get it使用 Ajax begin Form 获取

In the Html在 Html

      @using (Ajax.BeginForm("test", "Inicio", new AjaxOptions { HttpMethod = "Post", OnSuccess = "Sucesso(data);" }))
      {
        <label>Nom : </label>
        <input type="text" id="name" name="name" class="form-control" required />
        <input type="submit" value="importer" />
      }

In The controller在 controller

    [HttpPost]
    public ActionResult test(string name)
    {
        return Json(new { retorno = name }, JsonRequestBehavior.AllowGet);
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在ASP.NET MVC中处理会话 - How to handle session in asp.net mvc 在ASP.NET MVC中处理按钮单击的正确方法? - Proper way to handle button clicks in asp.net mvc? 如何在mvc3 asp.net中的表单提交上发送文本框值作为参数 - how to send text box value as parameter on form submit in mvc3 asp.net 如何在ASP.NET MVC中处理同一表单上的编辑和删除按钮? - How to handle an edit and delete button on the same form in ASP.NET MVC? 如何使用 C# 在 ASP.NET MVC 中获取可变的 asp-route-parameter? - How to get a variable asp-route-parameter in ASP.NET MVC with C#? 如何在asp.net C#MVC4中的预搜索模块中处理分页? - how can i handle pagination in asp.net C# MVC4 in advance search module? 参数上的ASP.NET MVC C#DataTypeAttribute - ASP.NET MVC C# DataTypeAttribute on parameter 将参数设置为Crystal报表ASP.net MVC c# - Setting Parameter To Crystal report ASP.net MVC c# 我在ASP.NET MVC的视图中有Button和TextBox-单击此按钮后如何将Button的值发送到TextBox? - I have Button and TextBox in View of ASP.NET MVC - how to send value of Button to TextBox after Click on this Button? 如何在ASP.NET SqlDataSource中处理空的CONTAINS()查询参数? - How to handle empty CONTAINS() query parameter in ASP.NET SqlDataSource?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM