如何在for循环中将参数传递给Modal

时间:2019-01-21 14:02:10

标签: c# razor

我在for循环中有一个引导程序模态,并希望将一些参数传递给每个单独的模态,以1.显示参数,并2.将单个表单及其参数提交给控制器。即使我在for循环中有模态,参数也不会改变,似乎它只是一个模态,而不是for循环中的每个模态。

@renderedDay.DayOfWeek, @DayDate
   <table id="item" style="background: white; width: 100%; padding: 0px; margin: 0px;">
        @{
           for (int h = 0; h < Model.Times.Count; h++)
           {
              <tr>
                 <td>
                  <!-- Button trigger modal -->
                  <button style="height:100%; width:100%;" type="button" class="btn btn-success" data-toggle="modal" data-target="#exampleModalCenter">
                                                    Reservieren
                   </button>

                   <!-- Modal -->
                   <div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
                   <div class="modal-dialog modal-dialog-centered" role="document">
                   <div class="modal-content">
                   <div class="modal-header">
                                                                @renderedDay.DayOfWeek, @DayDate
                   <h5 class="modal-title" id="exampleModalLongTitle">Termin Reservierung (19.01.2019 / 08:30)</h5>
                   <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                   <span aria-hidden="true">&times;</span>
                   </button>
                </div>
              <div class="modal-body">
              <form class="form-inline">
                <hr />Falls Sie für einen anderen USZ-Mitarbeiter einen Termin reservieren wollen, geben Sie dessen USZ-Kürzen unten ein. <hr />
                <div class="input-group mb-3">
                                                                        <input type="text" class="form-control" placeholder="USZ-Kürzel" aria-label="Recipient's username" aria-describedby="basic-addon2">

           <div class="input-group-append">
                                                                            <button class="btn btn-outline-primary" type="button">Mitarbeiter suchen</button>
                                                                        </div>
           </div>

                                                                </form>
                                                            </div>
                                                            <div class="modal-footer">
                                                                <button type="button" class="btn btn-secondary" data-dismiss="modal">Abbrechen</button>
                                                                <button type="button" class="btn btn-primary">Reservieren</button>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </td>

0 个答案:

没有答案