6 Replies - 1416 Views - Last Post: 03 April 2009 - 12:39 AM Rate Topic: -----

#1 oasisjoel  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 274
  • Joined: 11-September 08

Loading

Posted 17 March 2009 - 08:31 PM

Is there a way while im getting a large file from my database there will be a loading message or something??

I tried this one but doesnt work

lblErrorMessage.Text="test";
					result = Helpers.Common.GetCallBackReport(dateReference, dateReference);

Is This A Good Question/Topic? 0
  • +

Replies To: Loading

#2 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1526
  • View blog
  • Posts: 5,961
  • Joined: 21-March 08

Re: Loading

Posted 18 March 2009 - 03:45 AM

you will need to use javascript. with ASP.Net, it will process all of the code in the code-behind before it posts back to the browser. This would be too late for a "loading" label. So you could use javascript on the button click.
Was This Post Helpful? 0
  • +
  • -

#3 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1526
  • View blog
  • Posts: 5,961
  • Joined: 21-March 08

Re: Loading

Posted 18 March 2009 - 07:01 AM

here is how I did it...

javascript function
<script type="text/javascript" language="javascript">
	function SetLoading(btnName) {
		document.getElementById("lblLoading").innerHTML = "Loading...";
		var btn = document.getElementById(btnName);
		if (btn) btn.click();
	}

	function Invisible(btn) {
		var button = document.getElementById(btn);
		if (button) button.style.visibility = "hidden";
	}
</script>



HTML/ASP.Net code
<body onload="Invisible('<%= btnHidden.ClientID %>')">
	<form id="form1" runat="server">
	<div>
		<input type="button" value="Open" name="btnOpen" onclick="SetLoading('<%= btnHidden.ClientID %>')" />
		<asp:Label ID="lblLoading" runat="server"></asp:Label>
		<asp:Button ID="btnHidden" runat="server" Text="Button" Visible="false" onclick="btnHidden_Click" />
	</div>
	</form>
</body>



protected void btnHidden_Click(object sender, EventArgs e)
{
	// Your long running process code

	lblLoading.Text = "Done";
}


basically, the "Open" button calls a javascript function that sets the text of the label, then it programmatically "clicks" on the hidden button, which fires the server-side code.

Now, you can't programmatically click on an ASP.Net control that is set to being not visible. ASP.Net does not create HTML code for controls that are invisible. So to get around this, I have the hidden button set to visible with ASP.Net and on the load of the page, I just javascript to set it to hidden.

This post has been edited by eclipsed4utoo: 18 March 2009 - 07:02 AM

Was This Post Helpful? 0
  • +
  • -

#4 oasisjoel  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 274
  • Joined: 11-September 08

Re: Loading

Posted 27 March 2009 - 11:41 PM

is this still usable even if im trying to send a pdf file to the user?? will the loading stop??
Was This Post Helpful? 0
  • +
  • -

#5 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1526
  • View blog
  • Posts: 5,961
  • Joined: 21-March 08

Re: Loading

Posted 28 March 2009 - 05:13 AM

View Postoasisjoel, on 28 Mar, 2009 - 01:41 AM, said:

is this still usable even if im trying to send a pdf file to the user?? will the loading stop??


I'm not sure I understand what you mean.
Was This Post Helpful? 0
  • +
  • -

#6 oasisjoel  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 274
  • Joined: 11-September 08

Re: Loading

Posted 28 March 2009 - 09:01 PM

this is my code in my c#
 objReport.ExportOptions.ExportFormatType = exportType;
						objReport.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
		
						DiskFileDestinationOptions dfo = new DiskFileDestinationOptions();
						
						string customerName= string.Concat(string.Empty, invoiceInfo.Tables[0].Rows[0]["AccountName"]);
						DateTime dateReference = DateTime.Parse(string.Concat(string.Empty ,invoiceInfo.Tables[0].Rows[0]["BillingStartDate"]));

						string reportFolder = string.Concat(string.Empty, Helpers.Settings.ReportPath);
						string reportName =  "BHKBilPreviewInvoice"+ fileFormat;
						dfo.DiskFileName = reportFolder + reportName; 

						if (!System.IO.Directory.Exists(reportFolder)) { System.IO.Directory.CreateDirectory(reportFolder); }
					
						objReport.ExportOptions.DestinationOptions=dfo;
						objReport.Export();
			

Was This Post Helpful? 0
  • +
  • -

#7 oasisjoel  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 274
  • Joined: 11-September 08

Re: Loading

Posted 03 April 2009 - 12:39 AM

Help please thanks
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1