我是MVC Razor的新手。MVC Razor按鈕點擊偶數通過參數
我有這樣的觀點:
@model SuburbanCustPortal.Models.CustomerModel
@{
ViewBag.Title = "Customer Summary";
}
<h2>Customer Summary Screen</h2>
<p>
Please select an account below or add an existing account.
</p>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm())
{
@Html.ValidationSummary(true, "Account creation was unsuccessful. Please correct the errors and try again.")
<div>
<fieldset>
<legend>Existing Accounts</legend>
@Html.Action("ExistingAccounts2")
<p>
<input type="submit" value="Add an Account" />
</p>
</fieldset>
</div>
}
哪些調用此方法:
[Authorize]
public ActionResult ExistingAccounts2()
{
return PartialView("ExistingAccounts", _client.RequestCustomersForAccount(User.Identity.Name));
}
後者又調用此局部視圖:
@model IEnumerable<SuburbanCustPortal.SuburbanService.CustomerData >
<br />
<br />
<table>
@if (Model != null)
{
foreach (var usr in Model)
{
<tr>
<td>
<input id="btnShowCustomer" name="btnShowCustomer2" type="submit" value="View"/>
</td>
<td>
@usr.AccountId
</td>
<td>
@usr.Name
</td>
@* <td>
@usr.DeliveryStreet
</td>*@
</tr>
}
}
</table>
<br />
這最終顯示此:
此操作到此爲止。
我想要的是能夠點擊客戶名稱旁邊的按鈕,並拉起客戶的帳戶。
如何將該客戶綁定到該按鈕以知道該拉出誰以及該按鈕如何將其拉出?
出錯 - 「data-customerNumber對於元素輸入無效的屬性」 –
那麼我將如何在我的控制器中獲取這些信息? – Danieboy