2

I have a Web Application that I built a C# class in that generates a Report. This report takes nearly 40 seconds to generate because it searches hundreds of folders for certain files. So I was hoping there was a way to display a "Loading.." icon as this report is generating. I have a gif stored in my Images folder that would be perfect. The research that I've done at this point mostly talks about picturebox's and image controls that can hold the image but I was hoping there was just a way of displaying the image above the report while its being created.

The Web Application is from a Web ADF Geocortex website and again I created a C# class that generates this report. Below is some code that may help.

/// <summary>
    /// Generates HTML for the current report using the data in
    /// the given table.
    /// </summary>
    /// <param name="reportLayers">The layers to include in the report.</param>
    /// <returns>
    public override string GenerateReportHtml(List<ReportLayer> reportLayers)
    {
        StringBuilder htmlString = new StringBuilder();
        StringWriter stringWriter = new StringWriter(htmlString);
        HtmlTextWriter writer = new HtmlTextWriter(stringWriter);



        string holdAPI = "";

        List<string> exclusions = GetExcludedFields();

        foreach (ReportLayer layer in reportLayers)
        {
            string[] strFiles = null;
            Boolean val = false;

            if (layer.Layer.Name == "Bottom Hole Location (OP)")
            writer.RenderBeginTag(HtmlTextWriterTag.P); // <p>
            writer.RenderBeginTag(HtmlTextWriterTag.Strong); // <strong>
            writer.Write(layer.Layer.Name);

            writer.RenderEndTag(); // end </strong>
            writer.RenderEndTag(); // end </p>

            writer.WriteBreak(); // <br />
            foreach (ReportFeature feature in layer.ReportFeatures)
            {

            // each feature will be in a table
                writer.RenderBeginTag(HtmlTextWriterTag.Table); // <table>

                foreach (ReportField field in feature.ReportFields)
                {
                    string fieldName = field.Alias;
                    if (!exclusions.Contains(fieldName))
                    {
9
  • We need more detail. Your question is vague and confusing. Commented Apr 28, 2010 at 21:14
  • thanks for giving me negative points. I am new at this... I'll post more information Commented Apr 28, 2010 at 21:15
  • I have an Image called Load.gif that is in an Image folder inside my Web Application. I have a C# class that creates a report and this report takes 40 seconds to generate so I wanted to display an Image stating that it's Loading.. Commented Apr 28, 2010 at 21:18
  • I've been doing research and I know there is a number of ways to display an image but was hoping there was a way to display one without presetting a picture box or some sort of image control. Can I not just call the image and have it appear above my report? Commented Apr 28, 2010 at 21:19
  • Josh -- you can edit your original question (instead of posting updates as comments). This helps refine the quality of questions (and their answers). Commented Apr 28, 2010 at 21:20

3 Answers 3

2

with this html...

<div id="rpt">
    <img src="Images/Load.Gif" />
</div>

then a jQuery ajax post on document.ready..

<script type="text/javascript">
    $(function() {
        $.post("/path/to/report", function(reportHtml) {
            $("#rpt").html(reportHtml);
        });
    });
</script>

When the ajax call returns you replace the div html with report. This would remove the image.

Sign up to request clarification or add additional context in comments.

Comments

1

A crystal report, a SSRS report, a custom report? This makes a difference, but if you can determine when the report is finished loading. I would consider using client side javascript to display an image and then remove that image when the report is finished loading. Really its hard to give you more unless you give us some code examples or elaborate in your question.

Comments

1

Sounds like a job for JQuery... here's an article which I think talks about what you're trying to achieve.

It'd be along the lines of

  1. Page Loads. -- insert a spinner.gif into the middle of a div which will contain the report
  2. Use JQuery to Get the report url setting it to fill the div with the results of the request.
  3. When it's loaded the report it should appear in said div.

1 Comment

@danswain: I would amend that to a "JavaScript framework" instead of specifically jQuery.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.