如何使用asp.net从html表中提取值?

时间:2018-05-15 17:31:50

标签: html asp.net

我有一张这样的表:

<tbody>
    @foreach (Class cs in Model.MyClass)
    {
         statut = (cs.statut == "yes") ? "enable": "disable";

        <tr class="@(cs.statut == "yes" ? "success" : "danger") ">
            <td rowspan="2" >@cs.title</td>
            <td>@cs.att[0]</td>
            <td>@cs.att2[0]</td>
            <td  rowspan="2">@cs.att3</td>
            <td rowspan="2"><button class="btn btn-primary" data-toggle="modal" data-target="#myModal">@(cs.statut == "yes" ? "Désactiver" : "Activer") </button></td>
            <td rowspan="2"><button class="btn btn-primary" data-toggle="modal" data-target="#modify">Modifier </button></td>
        </tr>
        <tr class="@(cs.statut == "yes" ? "success" : "danger") ">
            <td>@cs.att[1]</td>
            <td>@cs.att2[1]</td>
        </tr>
        <div class="modal fade bs-example-modal-md" id="modifier" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog modal-md" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title" id="myModalLabel">Modify @cd.title</h4>
                    </div>
                    <div class="modal-body">
                        <form class="form">
                            <div class="">
                                <label for="groupe" class="col-sm-3 control-label">Groupe</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" id="groupe" value="@cs.title">
                                </div>
                            </div>

                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                        <button type="button" class="btn btn-primary">Confirm</button>
                    </div>
                </div>
            </div>
        </div>

    }

</tbody>

我想做一些修改,但我不知道如何获得该行的实际值? 当我测试修改按钮时,我得到所有这些底部的相同值,它是第一行。 提前谢谢,

0 个答案:

没有答案