Hi all,
First time poster, but I'd like to ask a simple question in ASP.NET C#.
I have a function that sends queries to an SQL Server. It takes a while, so I'd like to display the details to the user. Something simple, like "Sending x out of 12345 total queries" with x constantly updating without interfering with the user. I tried I'd really prefer to display it on the page without adding too much to the code.
mydata = "Sending " + begin.ToString() + " out of " + end.ToString() + " total queries.";
Response.Buffer.Equals(true);
Response.Flush();
lblProgress.Text = mydata;
This is the idea of what I'm looking for.
I'd like to avoid adding some ridiculous AJAX library for now.
The following code has an idea of what I'm looking for. I found some sample code that will send JavaScript, but that didn't seem to work on my page. The second part of that function is what I tried, but I know it won't really work.
public void myLongRunningJob(int begin, int end)
{
string mydata;
mydata = "<script>UpdateStatus(" + begin + ", " + end + ");</script>";
Response.Write(mydata);
Response.Flush();
System.Threading.Thread.Sleep(90);
}
<script language="javascript" type="text/jscript">
function UpdateStatus(i, j) {
var obj = document.getElementById("status");
obj.innerHTML = "Sending " + i + " out of " + j + " total queries.";
}
</script>
Thanks for any reply.