Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Accessing custom control using javascript on the client page.

Accessing custom control using javascript on the client page.

Scheduled Pinned Locked Moved ASP.NET
csharpjavascripthtmlhelptutorial
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rico MNC
    wrote on last edited by
    #1

    I have been tasked with replacing some DOM and javascript with an ASP custom control. The aspx page is using master pages. What I need to do is access the custom control with javascript in the aspx page. The control and its C# code behind are working, but I need to access a listbox contained within the control. I seem to be unable to access the control at all. For example, in the aspx page I have the custom control like this:

    ;

    In another page using an AJAX slider control, I have been able to access it like this:

    var sliderUpdater = $find("SliderBehavior");

    ... then I am able to get and set properties for the slider. However, trying similar approaches with our custom control all results in returning null from the $find. Note: our control does not currently have any extenders or BehaviorID. I will post more code details if necessary. Any ideas, help, or links would be appreciated. Thank you.

    N 1 Reply Last reply
    0
    • R Rico MNC

      I have been tasked with replacing some DOM and javascript with an ASP custom control. The aspx page is using master pages. What I need to do is access the custom control with javascript in the aspx page. The control and its C# code behind are working, but I need to access a listbox contained within the control. I seem to be unable to access the control at all. For example, in the aspx page I have the custom control like this:

      ;

      In another page using an AJAX slider control, I have been able to access it like this:

      var sliderUpdater = $find("SliderBehavior");

      ... then I am able to get and set properties for the slider. However, trying similar approaches with our custom control all results in returning null from the $find. Note: our control does not currently have any extenders or BehaviorID. I will post more code details if necessary. Any ideas, help, or links would be appreciated. Thank you.

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Rico MNC wrote:

      returning null from the $find

      What ID are you using in the find? Don't forget about the name mangling that ASP.NET applies to IDs


      only two letters away from being an asset

      R 2 Replies Last reply
      0
      • N Not Active

        Rico MNC wrote:

        returning null from the $find

        What ID are you using in the find? Don't forget about the name mangling that ASP.NET applies to IDs


        only two letters away from being an asset

        R Offline
        R Offline
        Rico MNC
        wrote on last edited by
        #3

        Yes I am aware of the name mangling, and have tried all my usual solutions. I will post more details and examples later. Thanks for trying to help.

        1 Reply Last reply
        0
        • N Not Active

          Rico MNC wrote:

          returning null from the $find

          What ID are you using in the find? Don't forget about the name mangling that ASP.NET applies to IDs


          only two letters away from being an asset

          R Offline
          R Offline
          Rico MNC
          wrote on last edited by
          #4

          When I try this:

          var foo = $find<"%=_Locations1.ClientID%>");

          The dynamic page during debug shows:

          var foo = $find"ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolderMain__Locations1");

          and foo is null after stepping through it.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups