views:

45

answers:

1

Here is my full problem so if anyone has any ideas or can offer some help, please let me know. I have a Website that will generate a Report and this Report takes some time to create. There is a MyReport.ASPX file that has a form1, Image1, and a ReportViewer control. There is also a MyReport.cs file that has C# code to generated a HTMLText string that the ReportViewer control will display. When I pull the Website up in the browser, the MyReport.cs file creates the Report before MyReport.ASPX ever gets called so my Image1 (which I need to display while the Report is being created) never gets displayed until AFTER the Report is created and displayed.

What do you suggest I do here? If I did not supply enough information, please let me know what else you need to know and I will gladly post it.

Thanks,

The below is in response to Derek.

<script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt;
<script>
$(document).ready(function(){
$(".loading").load("http://servername/Geocortex/Essentials/Web/SelectionReport1.aspx");
});
</script>

<%@ Page Language="C#" AutoEventWireup="true" Codebehind="App_Code/MyReport.cs" Inherhits="Geocortex.Essentials.WebFramework.SelectionReportPage" Culture="auto" UICulture="auto" %>
+1  A: 

One method would be to move the report generating code to a webservice, or PageMethod within your page. Have your aspx page display an image, then once the page is loaded, make an ajax call to your webservice (or Page Method), using js or jquery, and update the page (remove the image and display the report returned from the webservice).

<div id="loading">  
<img src="..."/> 
</div> 

Then using jquery in the document.ready event:

$(document).ready(function(){ 
$(".loading").load(url of page with reportviewer control); 
});
derek
Hi Derek- Bare with me as I may not be understanding you correctly. I can remove the ReportViewer from MyReport.ASPX and leave the Image1 remaining. If I create a new ASPX page and just have the ReportViewer control in it what do I need to do from there? How can I tell when the Report is ready? How do I switch between the two pages?
Josh
ok I see, the ReportViewer is in a separate control. Create a page with the ReportViewer control. Your main page will have the image. Do a jquery.load() to load the ReportViewer page into the div where the image is. The image will appear until the jquery gets the response from the Reportviewer page, at which point it will load the reportviewer content into the div.
derek
Hi Derek- Can you show me some code on what you mean? I'm still learning this
Josh
so basically have a page with an image in it:<div id="loading"> <img src="..."/></div>Then using jquery in the document.ready event:$(document).ready(function(){ $(".loading").load(url of page with reportviewer control);});Here's the link to the jquery load doc: http://api.jquery.com/load/
derek
Hi Derek- I think this is getting very close to complete.. In my above code I placed exactly what you said to in the SelectionReport.aspx (Page that contains just the Image). Then I have another page called SelectionReport1.aspx that has just the ReportViewer control. When I run the website in my browser the SelectionReport.aspx shows the image but the SelectionReport1.aspx never seems to replace the Image much less produce a report. Could the problem be at the last line of code I placed where the Page Inherits and Codebehind are set? Both Pages have that same line of code
Josh
I'm guessing but I think in the Page Inheritance, Geocortex.Essentials.Webframework.SelectionReportPage might be looking for SelectionReport.aspx (which only has the image now). So it doesn't know to go to the other page and generate the report first?
Josh
that should be ok. You may want to create a "hello world" html page for testing and load that into the loading div. If you can, debug the javascript in firebug to make sure the .load is getting called and getting a response.
derek