【C#】@using (Html.BeginForm())参数示例

@using (Html.BeginForm())参数示例

原文链接:https://www.cnblogs.com/firstcsharp/p/3238321.html

  1. 指定表单提交方式和路径等

    @using (Html.BeginForm("Index", "Home", FormMethod.Get, 
    new { name = "nbform", id = "nbform" }))
    
  2. 指定表单提交为数据方式

    @using (Html.BeginForm("ImportExcel", "Stock", FormMethod.Post, 
    new { enctype = "multipart/form-data" }))
    
  3. 下面的操作可以防止提交链接后面自带参数

    @using (Html.BeginForm("AddDIYBillOfLading", "BillOfLading", 
    new { id ="" }, FormMethod.Post, 
    new { name = "myform", id = "myform" }))
    

你可能感兴趣的:(学习笔记)