How can I load a custom .ascx item from a console app or windows service?

We use custom ascx elements as templates for documents (like invoices). Now I need to download, render to HTML, and then convert to PDF these controls from Windows Service.

So what's the correct way / workaround? TemplateControl.LoadControl (path) doesn't work.

+2


a source to share


2 answers


I honestly don't know how to do this. However, if I'm stuck with this issue, I think I would download the ASP.NET MVC source and see what they do to render the partial view (a partial view in MVC is essentially a .ascx control). The method Render

to System.Web.Mvc.WebFormView

be a good starting place.



+1


a source


You are probably wrong to be honest. Your library should probably be built into a library and then have a user control interface with that library. Then you can use this same logic to fill in values ​​in a form or similar.

You will likely run into a lot of problems trying to load a control and deal with things that don't exist outside of ASP.Net, such as session variables and viewstate.



Basically what you are asking for is a report that is processed by something like Crystal Reports or SQL Server Reporting Services.

0


a source







All Articles