Results 1 to 2 of 2

Thread: Can we access controls within user controls on the client side without using ctl0_Con

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2006
    Posts
    589

    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

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width