Jump to content
Xtreme .Net Talk

disable an object created by custom control on client-side


Recommended Posts

Posted

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.

 

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

 

 

anyone knows how to resolve this?

slow down when you need to hurry, stop when you need to move on,

look back when you need to forget, or you might slip and leave sanity

Posted

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

slow down when you need to hurry, stop when you need to move on,

look back when you need to forget, or you might slip and leave sanity

Posted

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')

slow down when you need to hurry, stop when you need to move on,

look back when you need to forget, or you might slip and leave sanity

Posted
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 -

 

Dim Script as String = String.Format("var ctrl = document.getElementById({0});", Me.ThisControl.UniqueID)

Joe Mamma

Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.

Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.

Posted
thanks Joe Mamma, ill keep that in mind :)

slow down when you need to hurry, stop when you need to move on,

look back when you need to forget, or you might slip and leave sanity

Posted

should have read:

[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]

Joe Mamma

Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.

Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...