0

質問があります。アクションメソッドで設定した以下の値があり、非表示の値がビューで使用できます。フォームをアクション メソッドに投稿すると、隠しフィールドの値が表示されなくなりました。これに関するアイデアはありますか?

   @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);  
4

1 に答える 1

1

交換してみてください

@Html.HiddenFor(model => Model.OutputStoredFileName)

@Html.HiddenFor(model => model.OutputStoredFileName)

FireBugまたはFiddlerで、リクエストで値がサーバーに投稿されていることを確認します。

于 2012-06-22T22:01:45.860 に答える