コントローラー内でアクションImagePopup
をトリガーするボタン入力をクリックすると、エラーが発生します。@ Url.Actionをクリックするとエラーが発生するのはなぜですか?
コード:
@{
var listData = (List<HimHer.Models.Stories>)ViewBag.Grid;
foreach (var imageName in listData)
{
<div class="col-md-4">
@Html.HiddenFor(model => model.Story)
<input
class="img-responsive img-thumbnail"
type="image"
onclick="location.href='@Url.Action("ImagePopup", "Stories", new {story= imageName.Story})'"
src="@("/UploadedFiles/"+ imageName.Image)"
alt="Submit"
width="100%"
height="100%"/>
</div>
}
}
それがエラーをスロー入力をクリックすると:それは存在しているにもかかわらず
The resource cannot be found. Requested URL: /Stories/ImagePopup
。 Storiesフォルダ内にあります。それはモデルのない部分的なビューです。
[HttpPost]
public ActionResult ImagePopup(string story)
{
ViewBag.PopupStyle = "";
ViewBag.PopupStory = story;
return View("GetImagesStories");
}
私は間違っていますか?
'[HttpPost]'が問題です。 – Ric