MVC 3 partialview popup problem
I have been trying to create a pop up window with some details gather from a partialview, but I was not able to do it.
I have followed this example, that is pretty clear, but did not work for me. MVC-pop up windows
I add my code, maybe someone can see better than me, why is not working.
Thanks in advance, Pablo.
This is the controller
[HttpGet]
[Authorize]
public ActionResult _CustomerDetails(int idAddress)
{
using (CustomerAddressClient client = new CustomerAddressClient())
{
var address = client.CustomerAddress_Read(idAddress);
ViewBag.CustomerAddress = address;
}
return PartialView();
}
Then I have the view with this code
@Ajax.ActionLink("Open popup", "_CustomerDetails", new AjaxOptions { HttpMethod = "GET", UpdateTargetId = "customerdetails2", InsertionMode = InsertionMode.Replace, OnSuccess = "openPopup" })
<div id="customerdetails2" ></div>
$(document).ready(function () {
$("#customerdetails2").dialog({
autoOpen: false,
title: 'Title',
width: 500,
height: 'auto',
modal: true
});
});
function openPopup() {
$("#customerdetails2").dialog("open");
}
and the partial view is just a list of the customer details
<table style="width: 100%;" class="customerTable">
<tr>
<td>Address1</td> <td>@ViewBag.CustomerAddress.idAddress</td>
</tr>
<tr>
<td>Address2</td><td>@ViewBag.CustomerAddress.Address2</td>
</tr>
<tr>
<td>Address3</td><td>@ViewBag.CustomerAddress.Address3</td>
</tr>
<tr>
<td>City</td><td>@ViewBag.CustomerAddress.City</td>
</tr>
<tr>
<td>CompanyName</td><td>@ViewBag.CustomerAddress.CompanyName</td>
</tr>
</Table>
Well,开发者_如何学Python the page keep on displaying in the same container, it won't display a popup.
精彩评论