ASP.Net 3.5: Specifying a control's HTML ID
I have a control which is repeated several times in a page. I'd like each occurrence to have a unique ID which I will define (not the horrible ID asp.net attaches). The problem is that I will only know the ID in run time. I'd like in the .aspx to write the following: <uc8:MyControl ID="<%=THEID%>" runat="server" /> but I know it doesn't work. What's the right way to approach this? Thanks a lot! You may add with code: MyControl control = new MyControl(); control.ID == "myControl" + count.ToString(); ph.Controls.Add(control); where ph - Placeholder or Panel control, count - some counter. Better