【发布时间】:2020-10-04 04:51:22
【问题描述】:
我编写了在页面上显示选项卡的代码,它工作正常,但问题是当我按下一些选项卡时,我在布局页面上看不到主导航栏的下拉列表,它看起来像空闲然后我应该按两次选项卡出现这种情况,我该如何解决这个问题
感谢您的帮助
谢谢
这是标签的代码
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" class="nav_link" data_id="1" href="#home">Home</a></li>
<li><a data-toggle="tab" class="nav_link" data_id="2" href="#menu1">Menu 1</a></li>
<li><a data-toggle="tab" class="nav_link" data_id="3" href="#menu2">Menu 2</a></li>
</ul>
<div class="tab-content">
<div id="home" class="tab-pane fade in active">
<div id="ProductsDiv1">
</div>
</div>
<div id="menu1" class="tab-pane fade">
<div id="ProductsDiv2">
</div>
</div>
<div id="menu2" class="tab-pane fade">
<div id="ProductsDiv3">
</div>
</div>
</div>
这是jquery
<script type="text/javascript">
$(function () {
$(".nav_link").click(function () {
//Custom attribute data_id is used to store the ID
//Get the ID
var id = $(this).attr("data_id");
$.ajax({
url: '@Url.Action("View_All_SupportTickets_tab1", "etraining")',
type: "get",
dataType: "html",
contentType: 'application/json; charset=utf-8',
data: JSON.stringify({ id: id }), //add parameter
success: function (data) {
//success
$('#ProductsDiv'+id).html(data); //populate the tab content.
},
error: function () {
alert("error");
}
});
});
});
</script>
这是动作控制器
public PartialViewResult View_All_SupportTickets_tab1()
{
var query = (from st in Db.Support_Teckets
join pr in Db.Technical_problem on st.Technical_problem_Id equals pr.Technical_problem_Id
where st.Status==null || st.Status==""
join x in
from rp in Db.Ticket_Reply.GroupBy(m =>
m.Support_Tecket_Id).Select(m => m.OrderByDescending(x => x.Date).FirstOrDefault())
join tr in Db.trainers on rp.trainer_id equals tr.trainer_id
select new { rp, tr }
on st.Support_Tecket_Id equals x.rp.Support_Tecket_Id into g
from gx in g.DefaultIfEmpty()
select new SupportTicketsDetails
{
Support_Tecket_Id = st.Support_Tecket_Id,
Created_Date = st.Created_Date,
//Created_Time = st.Created_Time,
Order_by = Db.trainers.Where(b => b.trainer_id == st.trainer_id).FirstOrDefault().trainer_name,
Technical_problem_name = pr.Technical_problem_name,
Created_details = st.Created_details,
Location = st.Location,
Technician = Db.trainers.Where(b => b.trainer_id == st.Current_Technician_Id).FirstOrDefault().trainer_name,
Status = string.IsNullOrEmpty(gx.rp.Status) ? "بلاغ جديد" : gx.rp.Status,
//Closing_Date = st.Closing_Date ,
Last_replier = Db.trainers.FirstOrDefault(a => a.trainer_id == gx.rp.trainer_id).trainer_name.ToString(),
Last_reply_Date = gx.rp.Date,
//Last_reply_Time = gx.rp.Time,
//points = st.points
}).ToList().OrderByDescending(a => a.Created_Date);
return PartialView("View_All_SupportTickets_tab1" ,query);
}
【问题讨论】:
标签: c# jquery asp.net asp.net-mvc model-view-controller