Following is my partial view - Call to the controller is done using an ajax call below
$.ajax(url, {
type: 'POST',
data: { Addresses: InboundAddresses },
cache: false,
crossDomain: true,
success: function (data) {
//Populate the form values
// Start Dialog Code
$myWindow = jQuery('#myDiv');
//instantiate the dialog
$myWindow.html(data);
$myWindow.dialog({
title: 'Select an address',
modal: true,
width: 'auto'
});
$myWindow.show();
$myWindow.dialog("open");
// End Dialog Code
$('#AddressTable').on('click', 'tr', function () {
// alert('You clicked row ' + ($(this).index()));
addAddress(InboundAddresses, Message, $(this).index())
});
},
error: function (jqXHR, textStatus, errorThrown) {
$('#Message').val('Kaboom!!! (The call blew up...#thatsucks)');
alert('The Dialog Box call failed...Sorry :(');
}
});
I traced the code and the call is sending the contents correctly ( Verified in fiddler ) Receiving method in controller does have objects but content in those objects is null. I think this is a parsing issue.
See the code for method below.
public PartialViewResult ShowAddresses(List<Address> Addresses)
{
ShowAddressViewModel viewModel = new ShowAddressViewModel();
viewModel.Addresses = Addresses;
viewModel.Message = "NEW";
return PartialView("_ShowAddress", viewModel);
}