Solved

HTM Report?

Posted on 2012-03-21
8
252 Views
Last Modified: 2012-04-05
OK need some help / advice on this one.

I found this WONDERFUL Piece of code:
http://www.codeproject.com/Articles/14367/Email-Templates

That uses an HTM file that you can format how you like it and define varaible within the HTM File run the parse command after defining all your variables and passing in their values and it creates a GREAT HTML E-Mail!  The best part of this is you can get a feel for what your e-mail is going to look like and design the layout on the screen.

I was hoping I could use this same code to generate a report...but this is where my lack of knowledge comes into play!  I don't want to write it to a file and then display that htm file on the screen because then I would need to clean up all those files on the server later...but rather I would like to generate the report virtually and then either display it to the user in HTML format with a bar that could be printed to a printer or display it as a PDF on the screen where the user could either print it or save it.

Any ideas on how I could accomplish this using the code in the above link project?

Thanks,
Mark
0
Comment
Question by:smithmrk
  • 4
  • 4
8 Comments
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 37750911
That's not HTML, that's ASP.Net.  

That said, what you want to do is pretty easy.  You can either pass parameters to a page that uses the paramters to personalize the page, or you can push HTML into a control on the page so it displays the way you want.
0
 

Author Comment

by:smithmrk
ID: 37752369
OK...I may not have mentioned I'm new at this...so do you have an example of how I would do that?

Thanks,
Mark
0
 
LVL 34

Accepted Solution

by:
Paul MacDonald earned 500 total points
ID: 37752553
Here are a few examples to get your feet wet.  Essentially, you'd put a control on the page, and give it an ID so you can reference it from the code behind and set it to runat='server'.  In the code behind, you can modify the InnerText or InnerHTML property of the control so the page shows whatever you want it to.

http://www.techrepublic.com/blog/programming-and-development/use-aspnets-literal-control-to-its-full-potential/618

http://www.dotnetperls.com/aspliteral

http://stackoverflow.com/questions/467016/can-i-dynamically-add-html-within-a-div-tag-from-c-sharp-on-load-event
0
 

Author Comment

by:smithmrk
ID: 37752648
OK This is good stuff, but what I'm trying to do is take the MyParser.Parse method that returns a string of HTML text put it into something like a MemoryStream (so I don't have to write it to the server) and then use the HTML Test in that MemoryStream to PopUp a NEW Window using JavaScript like Window.Open to display this HTML Text so the operator can print it.

I've found lots of examples...but not quite what I'm looking for and like I said I'm new to this stuff so the examples I have found don't quite match what I'm trying to accoplish, so I'm having trouble putting all the missing pieces together.

I found this which is similar to what I'm trying to do but instead of taking the current page I want to take the text from my MyParser.Parse string and Popup a NEW Window.

http://forums.asp.net/t/1038709.aspx/1

Can you help me take a string of HTML and and Popup a NEW Window?

Thanks,
Mark
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 37752919
Sorry, even if it's possible, I'm not that smart.  

I'd do this by having a fixed aspx page (with only literal control on it) that you can pop-up as a new window.  As the page loads, have it inject the appropriate HTML into the literal.  You'll get the same effect, and you'll only have the one extra page.
0
 

Author Comment

by:smithmrk
ID: 37753324
I'm sure it's possible...it's just a matter of figuring it out.

I appreciate your help and maybe someone else will chime in with an idea.

Thanks,
Mark
0
 

Author Closing Comment

by:smithmrk
ID: 37813119
I found a solution for now using some of links you provided.  I'll keep working on it, but I have a work around for now.

Thanks!
Mark
0
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 37813125
Happy to help!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now