In my ASP.NET application I have around 7 to 8 Label controls and currently my code to set their Text value looks like this:
while (MyReader.Read())
{
if(j>=i && j-i<=10 && j<(10+i+a))
{
Label"+[j]+".Text=a;
}
j++;
}
Now my label name statred from 1 to 8, I dont want to repaeat my statements like:
-
label1.text=a;
-
label.text=b;
What to do?
That actually should resolve your issue:
However as Jon suggested, it would be better to manage your labels in more generic way using list or something.