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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. Using Javascript Client-Side to Hide .net ASCX UserControl

Using Javascript Client-Side to Hide .net ASCX UserControl

Scheduled Pinned Locked Moved Web Development
csharpjavascripthelptutorialquestion
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.
  • G Offline
    G Offline
    graemea100
    wrote on last edited by
    #1

    I am creating a web app that has several UserControls loaded. What I want to do is when the user clicks the Datalist Item that has a Controls corresponding value, it sets the UserControl to being visible. All the other UserControls are set to hidden. I know how to set Textboxes etc to hidden and visible using Javascript, but how do I set the UserControl to hidden and visible when the correct item in the datalist is selected. Any help would be greatly appreciated. Graeme:^)

    V 1 Reply Last reply
    0
    • G graemea100

      I am creating a web app that has several UserControls loaded. What I want to do is when the user clicks the Datalist Item that has a Controls corresponding value, it sets the UserControl to being visible. All the other UserControls are set to hidden. I know how to set Textboxes etc to hidden and visible using Javascript, but how do I set the UserControl to hidden and visible when the correct item in the datalist is selected. Any help would be greatly appreciated. Graeme:^)

      V Offline
      V Offline
      Vasudevan Deepak Kumar
      wrote on last edited by
      #2

      Hi Graeme: You can load the .ASCX itself into a DIV right? This div, with a distinct id, you can toggle its visibility status! Did this help you? Deepak Kumar Vasudevan Personal Web: http://vdeepakkumar.netfirms.com/ I Blog At: http://deepak.blogdrive.com/

      G 1 Reply Last reply
      0
      • V Vasudevan Deepak Kumar

        Hi Graeme: You can load the .ASCX itself into a DIV right? This div, with a distinct id, you can toggle its visibility status! Did this help you? Deepak Kumar Vasudevan Personal Web: http://vdeepakkumar.netfirms.com/ I Blog At: http://deepak.blogdrive.com/

        G Offline
        G Offline
        graemea100
        wrote on last edited by
        #3

        Thanks Deepak I will try that and let you know how it goes. Graeme:)

        G 1 Reply Last reply
        0
        • G graemea100

          Thanks Deepak I will try that and let you know how it goes. Graeme:)

          G Offline
          G Offline
          graemea100
          wrote on last edited by
          #4

          Excellent that worked brilliantly. Just have to set the height and width and visibility, as I was having a problem that the rest of the items below the ascx page (static data/GUI) do not move down when you set the visibility to visible. It seems to place is over the top of the items currently on the page, instead of moving them down. We will have to set the height depending on the size of the DIV that we set up for each control. Is there any way of getting the height of the DIV tag as a variable and just increasing the height based on the height of the div that should be visible. IE: can you get the div's height value at run time from the client side script, and when setting the visibility, setting the height also? Thanks for the help:laugh:

          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