I have a User Control in which I have one label.
<asp:Label ID="lblProductionName"
runat="server"
Text="Production Name will come here">
</asp:Label>
I render the given UC from code behind using this function:
private string RenderControl(Control control)
{
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
HtmlTextWriter writer = new HtmlTextWriter(sw);
control.RenderControl(writer);
return sb.ToString();
}
After rendering, I get this as the output string:
<span id="lblProductionName">Production Name will come here</span>
Now, when I put two instances of the same User Control, I get the same span ID in the output string.
I want to generate two different IDs for two instances of User Control. How can I generate it?