我在强类型视图中有一个模型,但我希望有一个选择按钮,它为每个项目显示一个模态,问题是如何在我的模态定义中使用剃刀,所以每个模态都称为 myModal1、myModal2 等对于客户名称:
<a class="btn" data-toggle="modal" href="#myModal">Select</a>
<div class="modal hide" id="myModal">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3>Customer Options</h3>
</div>
<div class="modal-body">
<p>
@Html.ActionLink("Edit", "Edit", New With {.id = currentItem.CustomerId}) |
@Html.ActionLink("Details", "Details", New With {.id = currentItem.CustomerId})
|
@Html.ActionLink("Delete", "Delete", New With {.id = currentItem.CustomerId}) |
@Html.ActionLink("Book Job", "Create", "Job", New With {.id = currentItem.CustomerId}, Nothing)
|
@Html.ActionLink("Jobs", "ShowCustomerJobs", "Job", New With {.id = currentItem.CustomerId}, Nothing)
|
@Html.ActionLink("Bills", "BillsForCustomer", "Bill", New With {.id = currentItem.CustomerId}, Nothing)
|
@Html.ActionLink("Send Message", "SendCustomerMessage", "SendMessage", New With {.id = currentItem.CustomerId}, Nothing)
|
@Html.ActionLink("Record Payment", "RecordPayment", "Payment", New With {.id = currentItem.CustomerId}, Nothing)
</p>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal">Close</a>
</div>
</div>
基本上是这样的(这不起作用):
<a class="btn" data-toggle="modal" href="#myModal@currentItem.CustomerId">Select</a>
<div class="modal hide" id="myModal@currentItem.CustomerId">
我不确定 Razor 中在 id 和 href 定义中调用 Razor 的正确定义是什么