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. Access control(s) inside ITemplate from code-behind

Access control(s) inside ITemplate from code-behind

Scheduled Pinned Locked Moved ASP.NET
helptutorial
5 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.
  • T Offline
    T Offline
    Tee
    wrote on last edited by
    #1

    I try to build a custom control. In the control, it has a collection of X custom control, while there is a ITemplate in X in which contains other controls. For example, The problem is I cann't access the "a" and "b" control directly from the code behind. I have to call FindControl () which it makes my code looks stupid (while you have a ten control to call). And i think it has a more ellegent way so i can call the control directly from the code behind. Please help me !!!!

    M 1 Reply Last reply
    0
    • T Tee

      I try to build a custom control. In the control, it has a collection of X custom control, while there is a ITemplate in X in which contains other controls. For example, The problem is I cann't access the "a" and "b" control directly from the code behind. I have to call FindControl () which it makes my code looks stupid (while you have a ten control to call). And i think it has a more ellegent way so i can call the control directly from the code behind. Please help me !!!!

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      IMO, you still need to use the FindControl method to get reference to the TexBoxes declared in the template, and you can expose them as a public property in the X custom control so that you can directly use them in code-behind.

      T 1 Reply Last reply
      0
      • M minhpc_bk

        IMO, you still need to use the FindControl method to get reference to the TexBoxes declared in the template, and you can expose them as a public property in the X custom control so that you can directly use them in code-behind.

        T Offline
        T Offline
        Tee
        wrote on last edited by
        #3

        Then why when i using a Atlas UpdatePanel inside my custom control, i can access the nested control directly. For example With the help of atlas, this time i can access "a" from code-behind. So i think it should have a way to populate nested controls in design mode. -- modified at 7:31 Thursday 21st September, 2006

        M 1 Reply Last reply
        0
        • T Tee

          Then why when i using a Atlas UpdatePanel inside my custom control, i can access the nested control directly. For example With the help of atlas, this time i can access "a" from code-behind. So i think it should have a way to populate nested controls in design mode. -- modified at 7:31 Thursday 21st September, 2006

          M Offline
          M Offline
          minhpc_bk
          wrote on last edited by
          #4

          Sorry, but couldn't see your sample code.

          T 1 Reply Last reply
          0
          • M minhpc_bk

            Sorry, but couldn't see your sample code.

            T Offline
            T Offline
            Tee
            wrote on last edited by
            #5

            Opp. the HTML-like tag just hits me again. Anywhere, I just found a great solution. Instead of using ITemplate for the "content" propertis, I just use a "Placeholder". And then everything just work great !!!!

            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