J
Jim McGivney
I am trying to form a string by concatenating the Text strings of a number
of Label controls. The Labels are Label33 to Label64. I thought I would
use a For Loop to increment through the labels. The code below does not
work as Text is not a recognized property of myControl, which is the name of
the control fetched by FindControl. Any suggestions as to how to use
FindControl to obtain the Text value of the found control would be
appreciated.
Thanks,
Jim
protected void myButton_Click(object sender, EventArgs e)
{
string MyInfo = "";
string Indx;
int i;
Control myControl;
for (i = 1; i < 32; i += 1)
{
Indx = "Label" + i.ToString();
myControl = FindControl(Indx);
MyInfo += myControl.Text;
}
do something here = MyInfo;
}
of Label controls. The Labels are Label33 to Label64. I thought I would
use a For Loop to increment through the labels. The code below does not
work as Text is not a recognized property of myControl, which is the name of
the control fetched by FindControl. Any suggestions as to how to use
FindControl to obtain the Text value of the found control would be
appreciated.
Thanks,
Jim
protected void myButton_Click(object sender, EventArgs e)
{
string MyInfo = "";
string Indx;
int i;
Control myControl;
for (i = 1; i < 32; i += 1)
{
Indx = "Label" + i.ToString();
myControl = FindControl(Indx);
MyInfo += myControl.Text;
}
do something here = MyInfo;
}