Making label ID at run time

Posted by Shoyebaziz123 under ASP.NET on 4/8/2010 | Views : 1422 | Status : [Member] | Replies : 2
Hello Friends,
I have 10 Labels naming Label1......Label10

String lbl = "Label";
String s;
String str = ".Text";

for (int i = 0; i <= 10; i++)
{
s = Convert.ToString(i);
lbl + s + str = Convert.ToString(i);
}

but it not works...showing error

The left-hand side of an assignment must be a variable, property or indexer

what is going wrong




Responses

Posted by: Vuyiswamb on: 4/8/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
what are you trying to do here

lbl + s + str = Convert.ToString(i); 


Thank you for posting at Dotnetfunda
[Administrator]

Shoyebaziz123, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pavanandey on: 4/8/2010 [Member] Bronze

Up
0
Down
Hi,,

what exactly ur trying to do are u trying to create lables at runtime and then add the same to the page are any thing else

Thanks
Pavan Kumar
Mark Answer if this fits the need

Shoyebaziz123, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response