Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ID of dynamically inserted user control

Reply
Thread Tools

ID of dynamically inserted user control

 
 
Bijoy Naick
Guest
Posts: n/a
 
      11-17-2004
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



 
Reply With Quote
 
 
 
 
Kikoz
Guest
Posts: n/a
 
      11-17-2004
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?


"Bijoy Naick" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView Dynamically Inserted Template with RadioButton gauty ASP .Net Web Controls 1 04-29-2010 10:27 AM
How can I access the dynamically inserted applet from another applet? huyi0912@hotmail.com Java 1 11-19-2007 03:38 AM
Dynamically Adding User Control with Child User Control Travis Pruitt ASP .Net Building Controls 0 01-13-2005 08:49 PM
Adding Rows Dynamically into the Table Web Control but only one row is getting inserted lucky ASP .Net 0 01-12-2005 10:45 AM
Determining 'first load' state of a dynamically inserted control John Burke ASP .Net Building Controls 2 05-05-2004 04:23 PM



Advertisments