disable an object created by custom control on client-side

lamy

Regular
Joined
Dec 12, 2005
Messages
56
Location
under your bed
suppose i made a custom control with a textbox controls, when its rendered it would have (Me.ID + $ + textbox name), IE allows object names with "$" sign, so theres no problem finding/altering the object, but in FF it doesnt, so doing this wouldnt work with FF.

Code:
document.getElementById("myControl$Textbox1").disable = false;


anyone knows how to resolve this?
 
actually i didnt choose the $ sign, it was like so when it got rendered to html, is there a way to change that?

hmnn... it worked for you in FF, now im totally lost coz it keeps returning undefined
 
oops, my mistake, i didnt notice that its rendered differently with attribute Name and ID

Name = MyControl$Textbox1
ID = MyControl_Textbox1

i guess the error was on document.forms[0].MyControl$Textbox and not on getElementById

i guess id have to change it to this document.getElementById('MyControl_Textbox1')
 
lamy said:
oops, my mistake, i didnt notice that its rendered differently with attribute Name and ID

Name = MyControl$Textbox1
ID = MyControl_Textbox1

i guess the error was on document.forms[0].MyControl$Textbox and not on getElementById

i guess id have to change it to this document.getElementById('MyControl_Textbox1')
when rendering the ID of a control, the rendered ID is simple Control.UniqueID.

so to render a document.getElementById -

Visual Basic:
Dim Script as String = String.Format("var ctrl = document.getElementById({0});", Me.ThisControl.UniqueID)
 
should have read:
Visual Basic:
[font=Courier New][color=#0000ff]Dim[/color] Script [color=#0000ff]as[/color] [color=#0000ff]String[/color] = String.Format("var ctrl = document.getElementById(""{0}"");", Me.ThisControl.UniqueID)[/font][font=Verdana]
[/font]
 
Back
Top