我正试图在点击超链接时通过bootstrap打开弹出窗口 这是数据通过数据库点击的超链接,点击这个应该打开一个bootstrap弹出窗口。
<td id="statusdiv_@item.EscId" class="statusdiv">@Html.ActionLink(@Html.DisplayFor(model => item.Status).ToString(), "Escalation")</td>
我希望弹出的分区为<div id="myModal" role="dialog">
这是我试图打开它的jquery
$(".statusdiv").click(function () {
$("#myModal").modal();
});
任何帮助将不胜感激。 完整的c#代码
@using iMBDian.Models;
@*@model List<iMBDian.Models.Escalation>*@
@model IEnumerable<iMBDian.Models.Escalation>
@{
Layout = "~/Views/Shared/_EmployeeLayout.cshtml";
string _vpth = Html.GetUrl("Escalation");
Languages _owrpr = new Languages();
_owrpr = (Languages)Session["objWrapper"];
}
<div class="row">
<div class="col-md-8 col-lg-offset-2">
@using (Html.BeginForm()) { }
@using (Html.BeginForm("Escalation", "Employee", FormMethod.Post, new { @class = "IssueForm", @enctype = "multipart/form-data" }))
{
<div class="col-md-12 login-text">
<div class="col-md-6">
Department
<div class="clearfix"></div>
@Html.DropDownList("ddlDepartment", new SelectList(ViewBag.Department, "DepartmentId", "DepartmentName", ViewData["Dept"]), "-- " +
HttpContext.GetLocalResourceObject(_vpth, "Department", _owrpr.GlobalCultureInfo).ToString() + " --", new { @class = "form-control" })
</div>
<div class="col-md-6">
Issue Type
<div class="clearfix"></div>
@Html.DropDownList("ddlIssueType", new SelectList(ViewBag.IssueType, "IssueId", "IssueType", ViewData["Issue"]), "-- Select Issue --", new { @class = "form-control" })
</div>
</div>
<div class="col-md-12 login-text">
<div class="col-md-6">
Employee
<div class="clearfix"></div>
@Html.DropDownList("ddlEmployee", new SelectList(ViewBag.Employee, "ErpCode", "Name", ViewData["Empl"]), "-- " +
HttpContext.GetLocalResourceObject(_vpth, "Employ", _owrpr.GlobalCultureInfo).ToString() + " --", new { @class = "form-control" })
</div>
<div class="col-md-6">
@HttpContext.GetLocalResourceObject(_vpth, "Priority", _owrpr.GlobalCultureInfo).ToString()
<div class="clearfix"></div>
@Html.DropDownList("ddlPriority", new List<SelectListItem>
{
new SelectListItem { Text = "High", Value = "High" },
new SelectListItem{ Text="Medium", Value = "Medium" },
new SelectListItem{ Text="Low", Value = "Low" },
}, new { @class = "form-control" })
</div>
</div>
<div class="col-md-12 login-text">
<div class="col-md-6 ">
@HttpContext.GetLocalResourceObject(_vpth, "UploadFile", _owrpr.GlobalCultureInfo).ToString()
<div class="clearfix"></div>
@Html.TextBox("fileUploader", "", new { @class = "form-control", type = "file" })
</div>
<div class="col-md-6">
@HttpContext.GetLocalResourceObject(_vpth, "Description", _owrpr.GlobalCultureInfo)
<div class="clearfix"></div>
@Html.TextArea("txtDescription", "", new { @class = "form-control", rows = "3", placeholder = HttpContext.GetLocalResourceObject(_vpth, "Description", _owrpr.GlobalCultureInfo) })
</div>
</div>
<div class="col-md-12 login-text">
<div class="col-md-12">
@Html.Hidden("FormType", "BindIssue")
<input type="submit" id="btnEscalation" class="btn btn-lg btn-primary" value='@HttpContext.GetLocalResourceObject(_vpth, "Submit", _owrpr.GlobalCultureInfo).ToString()' />
</div>
</div>
if (ViewBag.ConfMsg != null)
{
<script>
$(document).ready(function () {
alert('@ViewBag.ConfMsg');
});
</script>
}
}
</div>
<div class="col-md-12">
<table class="table table-striped rht-table" cellpadding="0" cellspacing="0">
<thead>
<tr>
<td colspan="2"><h2><strong>@HttpContext.GetLocalResourceObject(_vpth, "TicketDetails", _owrpr.GlobalCultureInfo).ToString()</strong></h2></td>
</tr>
<tr class="bg-danger" style="background: #2d323e !important; border-radius: 10px;">
<th>@HttpContext.GetLocalResourceObject(_vpth, "CreatedBy", _owrpr.GlobalCultureInfo).ToString()</th>
<th>@HttpContext.GetLocalResourceObject(_vpth, "CreatedDate", _owrpr.GlobalCultureInfo).ToString()</th>
<th>@HttpContext.GetLocalResourceObject(_vpth, "IssueType", _owrpr.GlobalCultureInfo).ToString()</th>
<th>@HttpContext.GetLocalResourceObject(_vpth, "AssignedTo", _owrpr.GlobalCultureInfo).ToString()</th>
<th>@HttpContext.GetLocalResourceObject(_vpth, "ClosedBy", _owrpr.GlobalCultureInfo).ToString()</th>
<th>@HttpContext.GetLocalResourceObject(_vpth, "ClosedDate", _owrpr.GlobalCultureInfo).ToString()</th>
<th>@HttpContext.GetLocalResourceObject(_vpth, "Description", _owrpr.GlobalCultureInfo).ToString()</th>
<th>@HttpContext.GetLocalResourceObject(_vpth, "Status", _owrpr.GlobalCultureInfo).ToString()</th>
<th style="padding:0px 10px;">
@HttpContext.GetLocalResourceObject(_vpth, "TimeRemaining", _owrpr.GlobalCultureInfo).ToString()
<p style="font-size:11px; margin-bottom: 5px;">HH:MM:SS</p>
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>@Html.DisplayFor(model => item.CreatedName)</td>
<td>@item.CreatedDate.ToString("dd-MMM-yyyy")</td>
<td>@Html.DisplayFor(model => item.IssueType)</td>
<td>@Html.DisplayFor(model => item.AssignedPerson)</td>
<td>@Html.DisplayFor(model => item.ClosedBy)</td>
<td>
@if (item.ClosedDate.ToString("dd MMMM yyyy") != "01 January 0001")
{
@Html.Raw(item.ClosedDate.ToString("dd MMMM yyyy"))
}
</td>
<td>
@if (item.CreatorDescription.Length > 10)
{
@Html.Raw(item.CreatorDescription.Substring(0, 10) + "...")
}
else
{@Html.Raw(item.CreatorDescription) }
</td>
<td id="statusdiv_@item.EscId" class="statusdiv">@Html.ActionLink(@Html.DisplayFor(model => item.Status).ToString(), "Escalation")</td>
@*<td> @Html.DisplayFor(model => item.Status) </td>*@
<td>
<div id="clockdiv_@item.EscId" class="clockdiv" tat="@item.CreatedDate.AddHours(item.TAT)">
<div style="display:inline-flex;">
<span class="hours"></span>:<span class="minutes"></span>:<span class="seconds"></span>
</div>
</div>
</td>
</tr>
}
</thead>
</table>
</div>
@*6-feb-2017 start*@
<div id="myModal" role="dialog">
<table class="table table-striped rht-table top-tbl">
<thead>
<tr class="bg-danger">
<th>@HttpContext.GetLocalResourceObject(_vpth, "Zone", _owrpr.GlobalCultureInfo).ToString()</th>
<td>@Html.TextBox("zone")</td>
<th>@HttpContext.GetLocalResourceObject(_vpth, "Date", _owrpr.GlobalCultureInfo).ToString()</th>
<td>@Html.TextBox("Date")</td>
</tr>
</thead>
<thead>
<tr class="bg-danger">
<th>@HttpContext.GetLocalResourceObject(_vpth, "CreatedBy", _owrpr.GlobalCultureInfo).ToString()</th>
<td>@Html.TextBox("CreatedBy")</td>
<th>@HttpContext.GetLocalResourceObject(_vpth, "CreatedDate", _owrpr.GlobalCultureInfo).ToString()</th>
<td>@Html.TextBox("Date")</td>
</tr>
</thead>
<thead>
<tr class="bg-danger">
<th>@HttpContext.GetLocalResourceObject(_vpth, "ClosedBy", _owrpr.GlobalCultureInfo).ToString()</th>
<td>@Html.TextBox("ClosedBy")</td>
<th>@HttpContext.GetLocalResourceObject(_vpth, "ClosedDate", _owrpr.GlobalCultureInfo).ToString()</th>
<td>@Html.TextBox("ClosedDate")</td>
</tr>
</thead>
<thead>
<tr class="bg-danger">
<th>@HttpContext.GetLocalResourceObject(_vpth, "Priority", _owrpr.GlobalCultureInfo).ToString()</th>
<td>
@Html.DropDownList("ddlPriority", new List<SelectListItem>
{
new SelectListItem { Text = "Open", Value = "Open" },
new SelectListItem{ Text="Close", Value = "Close" },
}, new { @class = "form-control" })
</td>
<th>@HttpContext.GetLocalResourceObject(_vpth, "IssueType", _owrpr.GlobalCultureInfo).ToString()</th>
<td>@Html.TextBox("IssueType")</td>
</tr>
</thead>
<thead>
<tr class="bg-danger">
<th>@HttpContext.GetLocalResourceObject(_vpth, "AssignedTo", _owrpr.GlobalCultureInfo).ToString()</th>
<td>@Html.TextBox("AssignedTo")</td>
<th>@HttpContext.GetLocalResourceObject(_vpth, "Branch", _owrpr.GlobalCultureInfo).ToString()</th>
<td>@Html.TextBox("Branch")</td>
</tr>
</thead>
<thead>
<tr class="bg-danger">
<th>@HttpContext.GetLocalResourceObject(_vpth, "Status", _owrpr.GlobalCultureInfo).ToString()</th>
<td>
@Html.DropDownList("ddlPriority", new List<SelectListItem>
{
new SelectListItem { Text = "Open", Value = "Open" },
new SelectListItem{ Text="Close", Value = "Close" },
}, new { @class = "form-control" })
</td>
<th>@HttpContext.GetLocalResourceObject(_vpth, "IssueDescription", _owrpr.GlobalCultureInfo)</th>
<td>@Html.TextArea("IssueDescription", "", new { @class = "form-control", rows = "3", placeholder = HttpContext.GetLocalResourceObject(_vpth, "Description", _owrpr.GlobalCultureInfo) })</td>
</tr>
</thead>
<thead>
<tr class="bg-danger">
<th>@HttpContext.GetLocalResourceObject(_vpth, "Forward", _owrpr.GlobalCultureInfo).ToString()</th>
<td>
@Html.DropDownList("ddlEmployee", new SelectList(ViewBag.Employee, "ErpCode", "Name", ViewData["Empl"]), "-- " +
HttpContext.GetLocalResourceObject(_vpth, "Forward", _owrpr.GlobalCultureInfo).ToString() + " --", new { @class = "form-control" })
</td>
<th>@HttpContext.GetLocalResourceObject(_vpth, "Attachment", _owrpr.GlobalCultureInfo).ToString()</th>
<td>@Html.TextBox("Attachment", "", new { @class = "form-control", type = "file" })</td>
</tr>
</thead>
<thead>
<tr class="bg-danger">
<th>@HttpContext.GetLocalResourceObject(_vpth, "Remarks", _owrpr.GlobalCultureInfo)</th>
<td>
@Html.TextArea("txtDescription", "", new { @class = "form-control", rows = "3", placeholder = HttpContext.GetLocalResourceObject(_vpth, "Description", _owrpr.GlobalCultureInfo) })
</td>
</thead>
</table>
@*6-feb-2017 end*@
</div>
</div>
<script>
$(document).ready(function (e) {
$('#btnEscalation').click(function () {
HideErrorMsg(); HideLblMsg();
var _alrt1 = ""
$('.form-control').each(function () {
var _xkid = $(this).context.id.slice(3);
if ($(this).val() == "" && _xkid != "eUploader" && _xkid != "Description") _alrt1 = 'Please Select ' + _xkid;
if (_alrt1 != "") {
$(this).closest('div').append('<div class="error">' + _alrt1 + '</div>');
$(this).focus();
event.preventDefault();
return false;
}
});
if (_alrt1 == "") $('#FormType').val('SaveData');
});
$('#ddlDepartment').change(function () {
$('.IssueForm').submit();
})
});
//2feb - 2017_start
function getTimeRemaining(endtime) {
var t = Date.parse(endtime) - Date.parse(new Date());
var seconds = Math.floor((t / 1000) % 60);
var minutes = Math.floor((t / 1000 / 60) % 60);
var hours = Math.floor((t / (1000 * 60 * 60)) % 24);
var days = Math.floor(t / (1000 * 60 * 60 * 24));
return {
'total': t,
'days': days,
'hours': hours,
'minutes': minutes,
'seconds': seconds
};
}
function initializeClock(id, endtime) {
var clock = document.getElementById(id);
//var daysSpan = clock.querySelector('.days');
var hoursSpan = clock.querySelector('.hours');
var minutesSpan = clock.querySelector('.minutes');
var secondsSpan = clock.querySelector('.seconds');
function updateClock() {
var t = getTimeRemaining(endtime);
//daysSpan.innerHTML = t.days;
hoursSpan.innerHTML = ('0' + t.hours).slice(-2);
minutesSpan.innerHTML = ('0' + t.minutes).slice(-2);
secondsSpan.innerHTML = ('0' + t.seconds).slice(-2);
if (t.total <= 0) {
clearInterval(timeinterval);
}
}
updateClock();
var timeinterval = setInterval(updateClock, 1000);
}
var deadline = new Date(Date.parse('2017/02/05'));
$('.clockdiv').each(function () {
var id = $(this).attr('id'), tat = $(this).attr('tat');
initializeClock(id, tat);
});
//2feb - 2017_end
//3feb - 2017_start
// $('.statusdiv').each(function () {
//$('.statusdiv').click(function () {
$(".statusdiv").click(function () {
$("#myModal").modal();
});
//alert('hello');
//$('#myModal').dialog({
// height:700,
// width: 700,
// //modal:true,
//});
//});
//3feb - 2017_end
</script>
@*19jan-2017_End*@