0

強く型付けされたビュー内にモデルがありますが、各アイテムのモーダルを表示する選択ボタンが必要です。問題は、モーダル定義内でかみそりを使用して、各モーダルが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">

idおよびhref定義内でRazorを呼び出すためのRazorの正しい定義が何であるかわかりません

4

1 に答える 1

2

角かっこを追加するだけです()@(currentItem.CustomerId)

<a class="btn" data-toggle="modal" href="#myModal@(currentItem.CustomerId)">Select</a>
        <div class="modal hide" id="myModal@(currentItem.CustomerId)">
于 2012-08-17T08:16:40.683 に答える