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()方法? –