dl.atkinson
New member
I have a web page that I need to be able to force to refresh. I am changing the contents of a label and then calling a function, but the label does not change until after the function call. Here is the code:
protected void UpdateAvailability(object sender, GridViewCommandEventArgs e)
{
// Get the ID of the record to be updated
int index = Convert.ToInt32(e.CommandArgument);
string id = grid.DataKeys[index].Value.ToString();
// Let user know products are being updated
statusLabel.Text = "Updating Availability and Active Status for Products...Please wait";
// I need something here to cause a refresh
VendorProducts.UpdateAvailableAndActive(id);
// Let the user know that we are done
statusLabel.Text = "Availability and active status updated for all products";
}
The first change to statusLabel never appears on the page. Does anyone know of a line of code that I can place after the content change to statusLabel that will cause the page to refresh before (or while) the function is called in the next line?
protected void UpdateAvailability(object sender, GridViewCommandEventArgs e)
{
// Get the ID of the record to be updated
int index = Convert.ToInt32(e.CommandArgument);
string id = grid.DataKeys[index].Value.ToString();
// Let user know products are being updated
statusLabel.Text = "Updating Availability and Active Status for Products...Please wait";
// I need something here to cause a refresh
VendorProducts.UpdateAvailableAndActive(id);
// Let the user know that we are done
statusLabel.Text = "Availability and active status updated for all products";
}
The first change to statusLabel never appears on the page. Does anyone know of a line of code that I can place after the content change to statusLabel that will cause the page to refresh before (or while) the function is called in the next line?