AFAIK, you cannot set the ID of a control in the ASPX portion of the code dynamically.
However, you can do something like this:
Dim myTextBox As TextBox = New TextBox()
myTextBox.ID = "WhatEverYouWantItToBe"
MyPlaceHolder.Controls.Add(myTextBox)
Then in your ASPX add a placeholder like this:
<asp:PlaceHolder id="MyPlaceHolder" runat="server" />
This allows you to create a textbox on the fly, set its ID and add it to the page dynamically.
Be aware of the ID: If you're adding the control to another repeating control (like a DataGrid or the Repeater) you'll need to make sure the ID is unique in the scope. I think you can use INamingContainer for that, but I can't remember how to use that exactly. I am also not sure if the container control handles this automatically for you, so you'll need to do a bit of testing to make sure this works.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to:
Die Interimsliebenden by
Einstürzende Neubauten (Track 1 from the album:
Tabula Rasa)
What's This?