我有一個問題,我有價值如下,我在行動方法中設置和隱藏的值在視圖中可用。現在,當我將表單發佈到一個操作方法時,隱藏的字段值就消失了。對此有何想法?MVC3隱藏的價值不堅持之間的形式回發
@using (Html.BeginForm("Create", "RunLogEntry", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.HiddenFor(model => Model.OutputStoredFileName)
<button name="submit" class="art-button" type="submit" value="Populate" style="width: 100px">
Attach</button>
}
[HttpPost]
public ActionResult Create(RunLogEntry runLogEntry, String ServiceRequest, string Hour, string Minute, string AMPM,string submit, IEnumerable<HttpPostedFileBase> file, String AssayPerformanceIssues1)
{
if(submit == "Populate")
{
//Runlogentry is the model
if ((System.IO.File.Exists(runLogEntry.OutputStoredFileName)))
System.IO.File.Delete(runLogEntry.LoadListStoredFileName);
您是如何獲得價值的?發佈(雙關意圖)您的控制器正在接收該值的操作... –
已更新代碼,我有一個按鈕,其中點擊操作方法 – user1475788