13

従業員の詳細を表示する MVC ビューのテーブルがあります。編集機能を追加したいのですが、新しいページで開くのではなく、ブートストラップ モーダルを使用して表示したいと考えています。( http://twitter.github.com/bootstrap/javascript.html#modals )

データはすでにページで利用できるので、ajax を使用する必要はないと思います。選択した従業員のデータをブートストラップ モーダルに渡し、同じ画面にポップアップ表示するには、jquery または razor コードが必要だと思います。以下は私のコードです。どんな助けでも大歓迎です。ありがとう

@Foreach(var item in Model.Employees)
{
<tr>
   <td>@User.Identity.Name
            </td>
            <td>@item.FirstName
            </td>....other columns
<td><a href="#myModal" role="button" class="btn" data-toggle="modal">Edit</a>
    <td>
    </tr>........other rows
}
**Bootstrap Modal**


<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">Edit Employee</h3>
  </div>

  <div class="modal-body">
    <p>Selected Employee details go here with textbox, dropdown, etc...</p>
  </div>

  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
    <button class="btn btn-primary">Save changes</button>
  </div>
</div>
4

2 に答える 2