相关疑难解决方法(0)

MVC 4表单 - 提交按钮不执行任何操作

试图在MVC4(+ Razor)中实现一个表单,但是提交按钮没有做任何事情.

控制器(应该获得后期操作):

public class GeneralController
{
    [HttpPost]
    public ActionResult SearchResults(SearchParamsModel searchParams)
    {
        // doin some stuff here
        return View("SearchResultsView");
    }
}
Run Code Online (Sandbox Code Playgroud)

查看(.cshtml)

@model Models.SearchParamsModel 
@using (Html.BeginForm("SearchResults", "General", FormMethod.Post))
{
    <section class="form-field">
        <input type="text" name="Property1" id="Property1" class="field field139 autocomplete-init-no-img" />
        <label for="Property1">value1</label>

        <form action="" method="post" class="clearfix">           
            <input type="submit" value="some value" class="submit btn blue-btn special-submit" />
        </form>
    </section>
}
Run Code Online (Sandbox Code Playgroud)

模型

public class SearchParamsModel 
{
    public string Property1{ get; set; }
}
Run Code Online (Sandbox Code Playgroud)

post submit asp.net-mvc-4

3
推荐指数
1
解决办法
6万
查看次数

标签 统计

asp.net-mvc-4 ×1

post ×1

submit ×1