Can we access controls within user controls on the client side without using ctl0_Con
pb: Can we access controls within user controls on the client side without using ctl0_ControlsName
When we create controls within our user controls, the way we can access those controls in client side is i guess:
getElementByID('the client id')
but the server chnages the names of those controls to: clt0_Controlsname, so i always have to use add ctl0 when I want to access to my controls of the user control on the client side.
is there a solution to this or that s just the way it is
thank you
Re: Can we access controls within user controls on the client side without using ctl0_Con
You can generate the javascript you need using Page.RegisterStartupScript and Page.RegisterClientScriptBlock. These methods accept strings, and you needn't pass it _ctl0_controlname, you can pass it controlname.ClientID, which is a string property which you'll need to concatenate into your javascript.
If it's a centralized function, you can pass it as a javascript call, again through concatenation.