开发者

How to get the Html Content from a View in Controller?

开发者 https://www.devze.com 2023-04-11 18:01 出处:网络
In my controller I call a static function from a class located in App_Code called QqPDF to generate a pdf. What I want is to be able to get the html string of some actions in QqPDF and use them in my

In my controller I call a static function from a class located in App_Code called QqPDF to generate a pdf. What I want is to be able to get the html string of some actions in QqPDF and use them in my pd开发者_如何学JAVAf. But I don't know how to get the string from a View.

Thanks.


You may take a look at the following article which illustrates how you could render some partials or views into a string from withing your controller.


Perhaps you should view your views things that take a view model and display them. If this data is needed elsewhere consider storing it in a string resource or something like that and then pass that item into your view. BUT maybe what you really want is to get the rendered HTML of the view. Perhaps this answer will point you in the correct direction

Getting a Partial View's HTML from inside of the controller

0

精彩评论

暂无评论...
验证码 换一张
取 消