I am using MVC 4 to create an application. I am using Rotativa to create a pdf. I am calling ActionAsPdf with a complex model
my model is
public class BrandingDetails
{
public int PDFFileNo { get; set; }
public string LogoImageUrl { get; set; }
public string WebsiteUrl { get; set; }
public string PhoneNumber_AU { get; set; }
public string PhoneNumber_NZ { get; set; }
public string FacebookImageUrl { get; set; }
public string TwitterImageUrl { get; set; }
public string PinterestImageUrl { get; set; }
public string YoutubeImageUrl { get; set; }
public string CruiseCode { get; set; }
public string ShipName { get; set; }
public string PortName { get; set; }
public string SailDate { get; set; }
public string CruiseNights { get; set; }
public string Destinations { get; set; }
public string QuoteRef { get; set; }
public string CruiseName { get; set; }
public string DescriptionCruise { get; set; }
public IEnumerable<CruiseOptions> CruiseOptions { get; set; }
}
I am calling the following
var viewModel = QuoteHelper.GetViewModel(item);
var pdfResult = new ActionAsPdf("CruiseDetails", quoteDetails, cruiseOptions);
var binary = pdfResult.BuildPdf(this.ControllerContext);
my Action method it is calling is
public ActionResult CruiseDetails(BrandingDetails quoteDetails, IEnumerable<CruiseOptions> cruiseOptions)
{
return View("CruiseDetails", quoteDetails);
}
but for some reason when I pass it to the Action all the data is passed bar the CruiseOptions .. that is set to no elements... how is that possible?
Too late, but following Josh's answer I have found a solution using JSON. I hope that this helps someone.