Visual Studio 2008, C#, ASP.NET
Need to make multiple copies (or instances) of a web user control programmatically.
I have UserControlFile.ascx which contains an asp:Label with ID="vhLabel" in it. In that file I set label's Text property through public string vhText variable, as usual:
public string vhText
{
set
{
vhLabel.Text = value;
}
}
There are also some divs and other html data in this file that cannot be created in C# programmatically, so I have to use ascx file.
Now, in code-behind file I need to:
- clone this user control many times;
- set unique value to label's property "Text" of each clone through "vhText" variable.
Please, share your suggestions on these issues. If you need, I can show my code here. I've been looking for an answer for very long, but still unsuccessful.