ID of dynamically inserted user control

B

Bijoy Naick

I am inserting controls dynamically into my page; both Web Controls and User
Controls. Code Below..

I noticed that inspite of specifying the ID for the user controls, in the
HTML, the name is set to : myUC2:_ctl0.. Whats with the :_ctl0?? How can I
get rid of it?

Bijoy

-----------------

Dim newControl As Control

for count = 1 to 5
newControl = New Textbox()
newControl.ID = "myTextBox" & count
Page.Controls.Add(newControl)
next

For User Controls I do

Dim uc As UserControl

for count = 1 to 5
uc = LoadControl("file.ascx")
uc.ID = "myUC" & count
Page.Controls.Add(uc)
next
 
K

Kikoz

You can't unless you give every inserted control its ID yourself. If your ID
is "MyID" it look like this: <containerID>:MyID.
And why would you need to get rid of it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top