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. Need Assistance with Collapsible Content (C#)

Need Assistance with Collapsible Content (C#)

Scheduled Pinned Locked Moved ASP.NET
csharphelptutorialannouncement
2 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.
  • A Offline
    A Offline
    ahayw01
    wrote on last edited by
    #1

    Hello, I have a web page (in C#) that stores news and events. The data (news and events) is categorized by month. When the user visits the page, I would like to display the content of the existing month only. For example, the user will see. August event 1 news 2 July June May April I would like the user to be able to click on any other month to display the content of that respective month. Ideally, only one month should be expanded at a time (however this is not imperative). Any help or assistance would be appreciated. If you need more information please let me know. Thank you, Allison

    A 1 Reply Last reply
    0
    • A ahayw01

      Hello, I have a web page (in C#) that stores news and events. The data (news and events) is categorized by month. When the user visits the page, I would like to display the content of the existing month only. For example, the user will see. August event 1 news 2 July June May April I would like the user to be able to click on any other month to display the content of that respective month. Ideally, only one month should be expanded at a time (however this is not imperative). Any help or assistance would be appreciated. If you need more information please let me know. Thank you, Allison

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      why dont you use Javascript to display / hide content. Say you have used the html code block as below :

      <div onclick="javascript:expandCollapsePane(this, 'dvContainer');">
      August
      </div>
      <div id="dvContainer">
      Event 1
      News 2
      </div>

      Now when user clicks on the Div Pane named august you can make the container div visible true or false :

      function expandCollapsePane(obj, pane) {
      var containerPane = document.getElementByID(pane);
      var isCollapsed = (containerPane.style.display == 'none');
      if (isCollapsed) {
      containerPane.style.display = 'block';
      }
      else {
      containerPane.style.display = 'none';
      }
      }

      The javascript just hides the dvContainer on click. To make all of them invisible when one is open, just create an array of all such elements you create and before expanding anyone of them do a for loop and hide each other element in the block. Hope you understand. :thumbsup::rose:

      Abhishek Sur


      My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

      **Don't forget to click "Good Answer" if you like to.

      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