【发布时间】:2013-11-15 00:03:33
【问题描述】:
我目前有这个代码:
foreach (var item in Model.LstBagels)
{
@Html.Hidden("txtId", item.BagelId)
<div id="bagel">
<div id="bagel-info">
<div id="bagel-image">
<img src="@Url.Content(String.Format("~/Resources/Images/{0}.jpg", item.Image))" alt="" />
</div>
@if (@BestelBagels.Resources.Views.Index.IndexStrings.Name == "Name")
{
<h2>@Html.DisplayFor(m => item.Name)<br /></h2>
}
else
{
<h2>@Html.DisplayFor(m => item.NameFr)<br /></h2>
}
<input class="button widthorder" type="submit" name="BtnOrder" value="@BestelBagels.Resources.Views.Index.IndexStrings.Bestellen"/>
</div>
</div>
当按下我的按钮时,我总是从所有项目或所有项目的列表中接收第一个 ID。 但是我怎样才能收到我提交的 ID? 我的 txtId 始终是我的 itemsource 中的第一个 Id。
问候
【问题讨论】:
标签: c# asp.net-mvc asp.net-mvc-3 http-post html-helper