Click to See Complete Forum and Search --> : setting a web control's id programatically


lcscne
01-24-2005, 08:24 AM
is it possible to set a web control's "ID" property programatically?
for instance?


Dim myControlId As String

myControlId = "idWhatever"
.
.
.
.
<asp:button id='<%# myControlId%>' ....


by the way this code does not work.

PeOfEo
01-24-2005, 01:33 PM
You can write out an html element and modify it's id like you did above and just do things 'the old way'.

You can set some properties like visible and text like this however:
mycontrol.visible = false
mycontrol.text = "hi"
You might try using id
like
mycontrol.id = something
the trouble is mycontrol would be the existing id.