0
我在ASP MVC部分類是這樣工作的:隱藏按鈕不會使用jQuery
<div class="table-responsive">
<table class="table" id="tbl_visitors" data-animate="fadeInRight">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.VisitorId)
</th>
<th>
@Html.DisplayNameFor(model => model.FirstName)
</th>
<th>
@Html.DisplayNameFor(model => model.LastName)
</th>
<th>
@Html.DisplayNameFor(model => model.TicketId)
</th>
<th>
@Html.DisplayNameFor(model => model.RequestStatus)
</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.VisitorId)
</td>
<td>
@Html.DisplayFor(modelItem => item.FirstName)
</td>
<td>
@Html.DisplayFor(modelItem => item.LastName)
</td>
<td>
@Html.DisplayFor(modelItem => item.TicketId)
</td>
<td>
@Html.DisplayFor(modelItem => item.RequestStatus)
</td>
<td id="item_checkbox">
@if (item.RequestStatus != "Pending") {
<input [email protected] checked="checked" class="use-this switch-toggle switch-flat-mini switch-toggle-flat" type="checkbox">
<label [email protected]></label>
} else {
<input [email protected] class="use-this switch-toggle switch-flat-mini switch-toggle-flat" type="checkbox">
<label [email protected]></label>
}
</td>
<th>
<a href="javascript:void(0);" onclick="deletevisitor(@item.VisitorId, @item.TicketId) ">Remove</a>
</th>
</tr>
}
</tbody>
</table>
</div>
<div class="alignright" id="div_btn_approve">
<button id="btn_approve_ticket" class="button button-border button-rounded button-green">Approve</button>
</div>
和腳本來禁用我的「指數」的觀點在局部視圖按鈕,如下所示:
function getVisitorsOfApprovedTicket(ticketId, requestedBy, schedule) {
var url = '/Member/GetVisitorViaTicketId?ticketId=' + ticketId;
$("#div_approved_ticket_visitors").load(url);
$("#hidden_created_by").val(requestedBy);
//$("#btn_approve_ticket").prop("disabled", true);
$("#btn_approve_ticket").hide();
}
當我嘗試通過創建腳本來把它藏在我的局部視圖,它隱藏的按鈕,但爲何它沒有在我的索引視圖工作時,我稱之爲局部視圖?你能告訴我怎麼做對嗎?謝謝。
你在哪裏調用這個函數? – madalinivascu
在我的索引視圖中,放置了我需要隱藏的按鈕的部分視圖。 – Ibanez1700
何時何地調用getVisitorsOfApprovedTicket()方法? –