我有一個Web應用程序,我在其中構建了一個C#類生成報告。此報告需要近40秒才能生成,因爲它會搜索數百個文件夾中的某些文件。所以我希望在報告生成時有一種方法可以顯示「Loading ..」圖標。我有一個存儲在我的圖片文件夾中的GIF,這將是完美的。我在這一點上所做的研究主要是討論可以保持圖像的picturebox和圖像控件,但我希望只有在報表創建時在報表上方顯示圖像的方式。在Web應用程序中使用C#顯示圖像
Web應用程序來自Web ADF Geocortex網站,我又創建了一個生成此報告的C#類。以下是一些可能有所幫助的代碼。
/// <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))
{
我們需要更多的細節。你的問題含糊不清。 – 2010-04-28 21:14:03
感謝給我負面的觀點。我是新來的...我會發布更多信息 – Josh 2010-04-28 21:15:42
我有一個名爲Load.gif的圖像,它位於我的Web應用程序中的圖像文件夾中。我有一個C#類創建一個報告,這個報告需要40秒生成,所以我想顯示一個圖像,說明它正在加載.. – Josh 2010-04-28 21:18:21