remove automatic idprefex

  • Thread starter Thread starter Gonçalo Boléo
  • Start date Start date
G

Gonçalo Boléo

I'm creating controls in runtime but the clientID always add "_ctl0" to my
ID name.
Is possible to remove this?

thanks,
Goncalo Boleo
 
Hi Goncalo,

You could just use the attributes collection of the control to change
whatever you want.

For example:

Dim x As New Button
x.Attributes("clientId") = "NOTctl0"
Me.FindControl("Form1").Controls.Add(x)

That will do it!

Good Luck!

James Steele
Senior .NET Consultant
(e-mail address removed)
http://weblogs.asp.net/jamessteele
 
You can set the ID explicitly. But it's important for ASP.NET to assign an
ID (and thus name) to all the controls so that when doing postbacks it can
keep track of them in order to maintain their state.

-Brock
DevelopMentor
http://staff.develop.com/ballen
 

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

Similar Threads


Back
Top