Html.BeginForm()自动发布日期时间选择器+ MVC4的onclick

时间:2013-06-27 07:21:58

标签: jquery asp.net-mvc-4 razor

我有一个执行HttpPost的视图。

只要我有文本框,它就可以正常工作。 我添加了一个日期时间选择器和下拉列表,表单会自动发布日期时间选择器和下拉列表。 我甚至看不到日期时间选择器和下拉列表的详细信息,它们只是出现并消失并形成帖子,并显示所需的错误消息。

使用jquery小部件创建日期时间选择器和下拉列表。

有人可以建议如何在MVC4中停止自动发布表单吗?

以下是我的观点:

@using P.B.O
@model O

 @using (Html.BeginForm("Create", "O", FormMethod.Post))
 {

@Html.ValidationSummary(true)
<fieldset>
    <legend>Create a New Organization</legend>

    <div class="editor-label">
        @Html.LabelFor(model => model.C) 
        @Html.TextBoxFor(model => model.C, new { @class = "txt"}) 
        @Html.ValidationMessageFor(model => model.C) 
    </div> <br />

    <div class="editor-label">
        @Html.LabelFor(model => model.N)
        @Html.TextBoxFor(model => model.N, new { @class = "txt"}) 
        @Html.ValidationMessageFor(model => model.N)
    </div> <br />

    <div class="editor-label">
        @Html.LabelFor(model => model.D)
        @Html.TextBoxFor(model => model.D, new { @class = "txt"}) 
        @Html.ValidationMessageFor(model => model.D)
    </div> 

    <div>
        <label for="check" class="chk">
            Del ?
            <input id="IsSoftDeleted" name="IsSoftDeleted" data-val-required="The Del? field is required." data-val="true" type="checkbox" class="check"  />
        </label>
    </div>

    <br />

  <input id="FromDate" name ="FromDate" data-val="true" type="datetime" class="datetime" />

        <input type="submit" value="Create" />
</fieldset>

}

0 个答案:

没有答案
相关问题