I read many question about that and tutorials, but the only one executed, and didnt work right.
I have a functions that scrobbling info from the other site, its a heavy task, so when i place that to Page_load, page didn`t shows until the scrobble script is done. I wanted to load scrobbled info dynamicly with ajax or async task. The only thing i found and it executed is
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
PhoneBaseC pbc = new PhoneBaseC(text);
PageAsyncTask asyncTask1 = new PageAsyncTask(pbc.OnBegin, pbc.OnEnd, pbc.OnTimeout, "Async1", true);
Page.RegisterAsyncTask(asyncTask1);
Page.ExecuteRegisteredAsyncTasks();
text.InnerHtml = pbc.GetAsyncTaskProgress() + "<br />";
}
But when i press the button the all page is freeze and progress messages such us “started”,”finished” are shown together when task is done completely.
I need to parallel work of gui and my task, maybe with progresbar of process completion.
I was using ajax in php long time ago, but i`m very new to asp.net.
P.S. Strange thing to me. If i`m comment the “Page.ExecuteRegisteredAsyncTasks();” line the task is still executing.
Sorry if the same questions was answered already, i didn`t find simple example, and those i found didnt compile to me for a lot of reasons i dont understand. And sorry for bad English.
You could offload the work onto a Signal R hub and update the client once the task is complete see Signal R in Nuget here http://nuget.org/packages/SignalR . Lots of tutorials online on how to acheive long running tasks and client updates just type signalr tutorials in google.