how to popup view using jquery or java script asp mvc2
I want popup view in asp mvc; how to popup view using jquery? When I click on link I want to popup RequirementDetails view.
<p>
<%:Html.ActionLink(list.JobTitle,"RequirementDetails","Admin",new{id=list.RequirementID},null)%>
</p>
My jQuery popup view:
<script type="text/javascript">
$(function () {
$('.popup-link').click(function () {
var href = $(this).attr('href');
$('<div><p class="popup-content"></p></div>').dialog({
autoOpen: true,
modal: true,
height: 300,
width: 500,
open: function () {
$(this).find('.popup-content').load(href);
},
Exit: function () {
$(this).dialog('Exit');
}
});
开发者_运维知识库 return false;
});
});
</script>
<p>
<%:Html.ActionLink(list.JobTitle,"RequirementDetails","Admin",new{id=list.RequirementID}, new { @class = "popup-link" })%>
</p>
It is working (it opens popup box when I click the link) but the problem is when I click close popup dialog it is closed, and second time I click on link two popups open; how do I solve this problem?
You could try setting the target
attribute of the anchor:
<%= Html.ActionLink(
list.JobTitle,
"RequirementDetails",
"Admin",
new{ id = list.RequirementID },
new { target = "_blank" }
) %>
精彩评论