Causing a page refresh mid-method?

K

Kieran Benton

I've got a situation where I would like to make a label control visible
whilst a few-seconds long process runs, something along the lines of
"Please wait...". At the moment this all occurs inside the postback
section of the page load event as:

private void Page_Load(object sender, System.EventArgs e)
{
if(!this.IsPostBack)
{
<...>
}
else
{
<...>
labLookingUp.Visible = true;
string postcode = g.LatitudeLongitudeToPostcode(lat,lon); // The long
running process!!
labLookingUp.Visible = false;
<...>
}
}

But no page update occurs between the Visible = true and Visible =
false, resulting in the control never becoming visible to the user. Is
there any elegant way around this? Cheers.
 
I

intrader

I've got a situation where I would like to make a label control visible
whilst a few-seconds long process runs, something along the lines of
"Please wait...". At the moment this all occurs inside the postback
section of the page load event as:

private void Page_Load(object sender, System.EventArgs e)
{
if(!this.IsPostBack)
{
<...>
}
else
{
<...>
labLookingUp.Visible = true;
string postcode = g.LatitudeLongitudeToPostcode(lat,lon); // The long
running process!!
labLookingUp.Visible = false;
<...>
}
}

But no page update occurs between the Visible = true and Visible =
false, resulting in the control never becoming visible to the user. Is
there any elegant way around this? Cheers.
Nothing too elegant, I am afraid. But you can render javascript that uses
a timer to refresh the label with whatever you want.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top