Solved

HTM Report?

Posted on 2012-03-21
8
247 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 33

Expert Comment

by:paulmacd
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 33

Accepted Solution

by:
paulmacd 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 33

Expert Comment

by:paulmacd
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 33

Expert Comment

by:paulmacd
ID: 37813125
Happy to help!
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
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 demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

705 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

12 Experts available now in Live!

Get 1:1 Help Now