I have following controller , in that controller I created session to save IENUMERABLE
data-set
[HttpPost]
[ValidateInput(false)]
public ActionResult Create_Brochure(IEnumerable<ProductsPropertiesVM> model)
{
IEnumerable<ProductsPropertiesVM> newmodel = model;
IEnumerable<BrochureTemplateProperties> sample = model.Where.....
Session["TemplateData"] = newmodel;
return View(sample);
}
EDIT:
Create_Brchure View page has href link to call PrintIndex
method in same class file
<a href="@Url.Action("PrintIndex", "Brochure")">Download ViewAsPdf</a>
this is PrintIndex
method
public ActionResult PrintIndex()
{
return new Rotativa.ActionAsPdf("Create_Brochure_PDF") { FileName = "TestActionAsPdf.pdf" };
}
I want to use that session list dataset again in Create_Brochure_PDF
controller method,so I created here that method
public ActionResult Create_Brochure_PDF()
{
IEnumerable<ProductsPropertiesVM> newmodel = Session["TemplateData"] as IEnumerable<ProductsPropertiesVM>;
IEnumerable<BrochureTemplateProperties> samplePDF = newmodel.Where(....
return View(samplePDF);
}
but in above method I'm getting null IEnumerable<ProductsPropertiesVM> newmodel
EDIT:
If I explain this whole scenario
Create_Brochure
controller method has a view ,- In that view I have href link to save that
Create_Brochure
view asPDF
- Once I click that href link I'm calling
PrintIndex
method so in that action method again its calling toCreate_Brochure_PDF
method , so I'm getting null object set inCreate_Brochure_PDF