1
I have a view (View1.cshtml) with filters, a whole layout and a graph within a div that is generated according to the filters.
I created another view (View2.cshtml) in white and I would like to pass to her only this div with the generated graph.
Assuming I have this link in View1:
<a href="View2">Enviar HTML</a>
And supposing my controller is that way:
public ActionResult View1()
{
negocio = new View1Negocio();
View1DTO dto = new View1DTO ();
dto.LstExercicios = negocio.ObterExercicios();
return View(dto);
}
public ActionResult View2()
{
negocio = new View1Negocio();
View1DTO dto = new View1DTO ();
dto.LstExercicios = negocio.ObterExercicios();
return new ViewAsPdf("View2", dto);
}
Is there any way to do this? What would I have to do in this code to send this html?
Thank you, I think Pechkin does the same as I am using: Rotary: https://github.com/webgio/Rotativa perhaps yours is more complete. It’s a lot of stops for my chart generation, so I didn’t want to go through the action. But if I can not pass the html I think I will not have option.
– Joao Paulo
Do not use Rotary. It causes problems in certain environments. I already reported the error to the developer almost a year ago and he said he would not correct.
– Leonel Sanches da Silva
Good to know. I’ll try to replace Pechkin then.
– Joao Paulo
Hi João Paulo, I read your comment stating that there are many parameters for graph generation. In this case would not it be interesting to work with the View being the type of your Model (example Graficoviewmodel)? I ask this because that way, when giving a post in View1 your parameters would all be sent to an Action that receives a parameter of type Graficoviewmodel where you can use them and build your View2. I believe this could help you or be an interesting alternative.
– Renan