Link to home
Start Free TrialLog in
Avatar of Michael Sterling
Michael SterlingFlag for United States of America

asked on

How do I create dynamic reports in HTML?

It is rumored that you can dynamically create HTML reports. How is this done? Are there some clear / concise examples or tutorials that I can follow? I'm open to using what ever tools / "weapons" that are at my disposal. (LINQ, XML, LINQ.XML etc.). I need to be able to do grouping correctly as well as use some complex queries for mining the data. Any help would be appreciated? I'm using VS 2010 .NET 3.5 [C#]. I'm looking into this option because my web application lives on a goDaddy server (server farm) and all other research and attempts at using reporting tools like Crystal and Report Viewer have come down to an insurmountable hurdle (for me at this juncture), that being the purchasing of an additional server to run the reporting from. So I'm seeking an alternative solution.
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Michael Sterling

ASKER

@kaufmed: i think i have seen it in the past in my research but abandoned it because i thought that crystal or report viewer were "better mouse traps" (reporting tools) but as i mentioned above they proved to be futile attempts. so i will look more into this option now, thanks.
I'd never really heard the term "HTML reports" before, and even though it sounds obvious, I wanted to make sure it was as it sounds. My research brought up that article, and it appeared to speak directly to what you are seeking.

Outside of that, I think what you are looking for can be accomplished through code--probably quite concisely using Linq. How tedious it becomes is dependent, in my estimation on how detailed/pretty you want the reports to be. I think the biggest hurdle would be the CSS to style the page, but even then I wouldn't expect it to be an hindrance.
@kaufmed: thanks. i will research this over the next couple days, (probably through the weekend as time allows). if you should come across anything else I'd appreciate the resource. Just so I'm clear, when you were speaking of the LINQ in your last comment, you were speaking to the actual data mining portion from which the data on the report would come from, correct?
when you were speaking of the LINQ in your last comment, you were speaking to the actual data mining portion from which the data on the report would come from
That, and the generation of the report. It's quite simple to create HTML using things like XDocument, XElement, et. al. found under the System.Xml.Linq namespace.

For example, let's tell the world we are here:

using System;
using System.Xml.Linq;

namespace _27579815
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            XElement report = new XElement("div",
                                    new XAttribute("id", "report"),
                                    new XText("Hello World!"));

            litReport.Text = report.ToString();
        }
    }
}

Open in new window


gets you:

User generated image
@kaufmed: i see. i've downloaded the code and compiled it with no problem. unless i'm misunderstanding how this application is supposed to work, i'm expecting to get a GUI like the one shown in the example. but when i try to run it i get message that says:

"A project with an Output Type of Class Library cannot be started directly."

Then it tells me to add it to my solution, which I do and I it still compiles fine. I guess I was hoping to see that GUI to design my reports. Am I supposed to be doing it all in code? Am I misinterpreting how this tool is supposed to work?
The "demo" is the screenshot you see.

User generated image
@kaufmed: never mind...just realized i needed to grab the demo project...duh!
this seems to be doing the trick. thanks