Hello everybody.
I have two instances of same user control.
This user control has a property.
Each instance has different value of this property and different ID.
For example:
Code:
<uc:UserControl ID="UC1" runat="server" prop="value1" />
<uc:UserControl ID="UC2" runat="server" prop="value2" />
I want to get the value of prop of specific user control, depending on a condition.
I try to do this by the following code:
Code:
int I;
UserControl UC;
if (condition) {
I = 1;
} else {
I = 2;
}
UC = (UserControl)FindControl("UC" + I);
string Prop = UC.prop;
But this code give an error said that
UC doesn't have a property called
prop.
Of course this error occurred because
UC didn't compiled in design mode.
How I can solve this problem?
Thanks for any reply.