i want to know if i can create an array of labels in the code Behind.
And then, if i can put label from the .aspx in the label Array with the id and manipulate it with this.
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes you can. Labels from the .aspx part will have a corresponding object in the codebehind file. There’s nothing special about them, they are just like any other .NET object. For example if you have markup that looks like this
The codebehind file will have something like
Depending on how your project was set up this may be in either the .cs file or the .designer.cs file. From there there’s nothing stopping you from adding them to an array and working with them from there.
For example
will make an array called
labelswith the 4 labels in it and then you can do whatever you’d like to them. Then you can dolabels[0]to get to the first one, etc. Is this what you had in mind?