how to Get label text value from ID in C#
Let give the example first
Inside the body tag
<asp:Label id="Label1" runat="server" Text="Hello world"/>
Inside the script tag using c#
void Page_Load(Object Source, EventArgs E)<br />{<br /> String test = Label1.Text<br />}
OK, thats the normal method.
But my problem is I have many Label.
Lets say Label1 until Label10 and I want to get the label value by using loop
Example: hope this kind of code exist, note that getLabelID is not a funtion or even exist, its just something that can get the Label based on its id where the parameter is a string. Is this thing exist?, if not any one have a solution?
void Page_Load(Object Source, EventArgs E)<br />{<br /> for(int aa=1; aa<=10; aa++)<br /> {<br /> String test = getLabelID("Label" + aa.toString()).Text;<br /> }<br />}