本文介绍了在asp.net mvc4中按F5时如何清除表单中的所有字段文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一张表格

Hi,
I have a form

@using (Html.BeginForm("Upload", "Upload", FormMethod.Post, new { enctype = "multipart/form-data" })) {
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>program</legend>

        <div class="editor-label">
            Programe Name :
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.prog_name)
            @Html.ValidationMessageFor(model => model.prog_name) <span style="color: red">*</span>
            <span style="color: red">@ViewBag.name</span>
        </div>

        <div class="editor-label">
            Version Number :
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ver_number)
            @Html.ValidationMessageFor(model => model.ver_number) <span style="color: red">*</span>
            <span style="color: red">@ViewBag.ver</span>
        </div>
<p>
            <input type="submit" value="Upload"/>
        </p>
    </fieldset>
}	



当我在任何(EditorFor)和按下提交按钮之前写一个文字

我想要按F5,清除字段中的所有文本

调试时返回[HttpGet]函数

我尝试做


when I write a text in any (EditorFor) and before press submit button
I want when press F5, clear all text in fields
when debug it returns to [HttpGet] function
I try to do

this.ModelState.Clear();



但文字不清楚

任何帮助?


but text doesn't clear
any help ?

推荐答案



这篇关于在asp.net mvc4中按F5时如何清除表单中的所有字段文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 15:01