EASY ONE? looping and updating labels with each iteration

  • Thread starter Thread starter Bruce Whitehouse
  • Start date Start date
B

Bruce Whitehouse

This should be an easy one, but I'm not sure the best way to do it.

I've got a form, and when I click a button it starts looping through an
array. With each iteration of the array I want it to change the status of a
label.

I realise that it must complete the execution of the code-behind page before
it can update the labels, so how do I do it?

TIA, Bruce
 
Hi,

I think he is talking about asp.net (note the code-behind page combination
of words :) )

Here is the code to find all controls and set their values (using
reflection):
FieldInfo[] fis = typeof(WebForm1).GetFields(BindingFlags.NonPublic |
BindingFlags.Instance);

foreach (FieldInfo fi in fis)

if (fi.FieldType == typeof(Label))

{

Label l = (Label)fi.GetValue(this);

l.Text = "Tubo";

}

Maybe there is an easier way (you could create an array of labels in Init()
method or something).
 
Sorry guys

I realise I posted this under ADO.NET rather than ASP.NET


actually, I know the status of all my labels and controls. this isn't
what I was trying to do.

What I was wanting to do was loop through some code in my VB (code behind
page). The loop is actually going through 15 or so web services (which take
up to 2 minutes each), so on each iteration of the loop (for each
webservice) I wanted to let the user know what the status was of each web
service call.

I'm about to re-write the page using an array and a datagrid. I'll be
letting the page complete, checking for what is to happen next, execute the
method, update label, let page reload, etc, etc.

Bruce
 
Back
Top